This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

typecast violation ?


Hi group,

GCC doesn't seem to honor the C90 standard for type casting

Consider following test case :

--/cygdrive/d/tests-->cat -n lval.c
1 int main()
2 {
3 char c;
4 (int)c += 4;
5 }
--/cygdrive/d/tests-->


As per C90 standard - section 6.3.4 - "Cast operators" states that
44 "A Casts does not yield an lvalue."
Shouldn't gcc flash error as "l-value" required for statement #4 ?
I tried -ansi, -std=c9x explictly but gcc didn't flash the
expected error ?

Did I miss anything ?

Aha .. GCC version info : here it is !

--/cygdrive/d/tests-->gcc -v
Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.2/specs
Configured with: /netrel/src/gcc-3.2-3/configure --enable-languages=c,c++,f77,java --enable-libgcj --enable-threads=posi
x --with-system-zlib --enable-nls --without-included-gettext --enable-interpreter --disable-sjlj-exceptions --disable-ve
rsion-specific-runtime-libs --enable-shared --build=i686-pc-linux --host=i686-pc-cygwin --target=i686-pc-cygwin --enable
-haifa --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --includedir=/nonexistent/include --libexecd
ir=/usr/sbin
Thread model: posix
gcc version 3.2 20020927 (prerelease)

Regards,
Nandkishor



_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]