Wednesday, 28 May 2014

[gccsdk] [Bug 253] New: GCC 4.7.4 Rel 1 Dev 2014-05-20: _kernel_osbget() failure

http://www.riscos.info/bugzilla3/show_bug.cgi?id=253

Summary: GCC 4.7.4 Rel 1 Dev 2014-05-20: _kernel_osbget()
failure
Product: GCC/GCCSDK
Version: other
Platform: Other
OS/Version: RISC OS
Status: NEW
Severity: normal
Priority: P1
Component: C compiler
AssignedTo: John.Tytgat@aaug.net
ReportedBy: duncan.moore@gmx.com
Estimated Hours: 0.0


gcc (GCCSDK GCC 4.7.4 Release 1 Development) 4.7.4 20140520 (prerelease)
[gcc-4_7-branch revision 210657]
http://www.riscos.info/downloads/gccsdk/testing/4.7.4/gccsdk-gcc-bin-4.7.4-Rel1dev.zip
SharedUnixLibrary 1.12
VirtualRPC-Adjust RISCOS 4.39, ARM 710


#include <stdio.h>
#include <stdlib.h>
#include "kernel.h"
#include "swis.h"
_kernel_oserror *swi_error;
_kernel_swi_regs regs;
int main(void) {
system("Echo ABCDE { > input_file }");

int handle=_kernel_osfind(0x40,"input_file"); // Open file for reading.
if (handle==_kernel_ERROR) {printf("Error opening file - aborting\n");return
1;}
printf("handle = %i\n",handle);

int ch=_kernel_osbget(handle); // Read byte from file.
if (ch==_kernel_ERROR) {
printf("Error reading file\n");
} else {
printf("character read = %c\n",ch);
}

regs.r[0] = 0;
regs.r[1] = handle;
swi_error = _kernel_swi(OS_Find, &regs, &regs); // Close file.
if (swi_error) {
printf("OS Error closing file: %s\n",swi_error->errmess);
} else {
printf("File closed\n");
}

system("Delete input_file");
return 0;
}

I've never used kernel.h much, apart from _kernel_swi(), but presumably the
above code should work? This is what I get:

*gcc err_osbget.c
*a/out
handle = 253
Error reading file
File closed

With the SharedCLibrary, it runs properly (but the default filename trips
elf2aif up):

*gcc -mlibscl err_osbget.c
Failed to open file 'a.out' for reading
collect2: error: elf2aif returned 1 exit status
*a/out
handle = 253
character read = A
File closed
*

--
Configure bugmail: http://www.riscos.info/bugzilla3/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.

_______________________________________________
GCCSDK mailing list gcc@gccsdk.riscos.info
Bugzilla: http://www.riscos.info/bugzilla/index.cgi
List Info: http://www.riscos.info/mailman/listinfo/gcc
Main Page: http://www.riscos.info/index.php/GCCSDK

No comments:

Post a Comment