rxi / fe

A tiny, embeddable language implemented in ANSI C
MIT License
1.31k stars 82 forks source link

Minor warning #26

Closed polluks closed 1 year ago

polluks commented 1 year ago

SAS/C Amiga Compiler 6.58
Copyright (c) 1988-1995 SAS Institute Inc.

====================
  return (chr = fgetc(udata)) ==  (-1)  ? '\0' : chr;
fe.c 550 Warning 85: return value mismatch for function "readfp"
                     Expecting "char", found "int"
Slink - Version 6.58
Copyright (c) 1988-1995 SAS Institute, Inc.  All Rights Reserved.

SLINK Complete - Maximum code size = 89848 ($00015ef8) bytes

Final output file size = 27496 ($00006b68) bytes
ooichu commented 1 year ago

It looks like compiler bug; from the C standard (ANSI/ISO 9899-1990):

6.8.6.4 The return statement ... If a return statement with an expression is executed, the value of the expression is returned to the caller as the value of the function call expression. If the expression has a type different from the return type of the function in which it appears, the value is converted as if by assignment to an object having the return type of the function. ...

polluks commented 1 year ago

I see. By the way my Amiga port seems to be broken, life.fe stops after a few iterations...

ooichu commented 1 year ago

Did it work before the automatic endianess detection commit? I'm also tested it with qemu-m68k and this works well. I am not an Amiga expert, does it use 32-bit addresses and does it do 32-bit alignment?

polluks commented 1 year ago

I don't know. At least my favorite compiler vbcc failed always. This seems to be a compiler issue because gcc and clang work fine. An Amiga can only use 31-bit addresses and alignment says: no odd addresses.