tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Can't compile the eiffel generated C files


From: Dave Dodge
Subject: Re: [Tinycc-devel] Can't compile the eiffel generated C files
Date: Thu, 28 Jul 2005 23:45:12 -0400
User-agent: Mutt/1.4.2i

On Thu, Jul 28, 2005 at 05:22:10PM -0400, Daniel Gryniewicz wrote:
> >   struct foo * x;
> >   char y = (char)x;
> > 
> > Which is obviously non-portable C code.  gcc will complain about it if
> > you turn up the warning level:
> 
> Worse than this, I believe gcc 4.0 will fail to compile this with an
> error.

That wouldn't surprise me.  Lots of projects have had to clean up
their code a bit to make it work with gcc 4.  Recent versions of gcc
have become stricter about what code they will accept.  There are a
few cases where gcc 3.4.3 will even emit code to intentionally crash
a program if it tries to invoke undefined behavior.  For example:

  #include <stdarg.h>
  void foo(int x,...)
  { va_list args; va_start(args,x); va_arg(args,short); va_end(args); }

foo.c: In function `foo':
foo.c:3: warning: `short int' is promoted to `int' when passed through `...'
foo.c:3: warning: (so you should pass `int' not `short int' to `va_arg')
foo.c:3: note: if this code is reached, the program will abort

                                                  -Dave Dodge




reply via email to

[Prev in Thread] Current Thread [Next in Thread]