Re: GCC for i386 allows 'invalid suffix "f" on integer constant'
Re: GCC for i386 allows 'invalid suffix "f" on integer constant'
- Subject: Re: GCC for i386 allows 'invalid suffix "f" on integer constant'
- From: Dirk Stegemann <email@hidden>
- Date: Tue, 14 Mar 2006 01:09:27 +0200
Hi,
Am 13.03.2006 um 22:29 schrieb Wim Lewis:
Interestingly, you get *different* incorrect results depending on
whether -mdynamic-no-pic is specified (in addition to the necessary
-fasm-blocks). If you specify -Wall, then gcc complains that you
haven't initialized 'f' --- so it's clearly interpreting the line
"float f = 2F;" in some unexpected way.
% gcc-4.0 -x c -arch i386 -pipe -fasm-blocks -Os -Wall -mdynamic-
no-pic -S t.c
t.c: In function ‘spork’:
t.c:6: warning: ‘f’ is used uninitialized in this function
% cat t.c
float spork (void) {
float f = 2F;
return f;
}
I already filed a different bug related to the '-fasm-blocks' flag,
which is revealed on i386 only. It is about initialising a float
variable using an integer constant (as also used in your code):
<rdar://4417221>
Try this one:
% echo "int main (int argc, char * const argv[]) {float f = 2f;return
0;}" > test.c
% /usr/bin/gcc-4.0 -arch i386 -fasm-blocks -c test.c
GCC *doesn't* complain about this code, although it should.
At runtime, variable 'f' is initialised using arbitrary data, as it
seems.
Maybe you should file a bug report as well, thoses issues seem to be
related.
My bug is still marked 'open'...
Regards,
Dirk Stegemann
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden