The documentation on GCC states that in freestanding environment, no 
assumptions are made: 
 
======== 
To make it act as a conforming freestanding 
implementation for a freestanding environment, use the option 
`-ffreestanding'; it will then define `__STDC_HOSTED__' to `0' and not 
make assumptions about the meanings of function names from the standard 
library 
======== 
 
However, a simple testcase shows that 
- different code is generated for function issuing the setjmp() call and any 
other function call in freestanding env (actually, the code for a function 
using setjmp() is the same both in hosted and freestanding env). 
 
- The 'variable might be clobbered' warning is emitted for setjmp() call even 
in freestanding env 
 
Try compiling the test case with the following flags: 
*1) gcc -DSETJMP=setjmp -ffreestanding -s ff.c 
*2) gcc -DSETJMP=setjmp -fhosted -s ff.c 
*3) gcc -DSETJMP=mysetjmp -ffreestanding -s ff.c 
 
and compare the output. *1 and *2 give the same output, which differs from *3.

-- 
           Summary: Disable special handling of functions with --
                    freestanding
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: alex dot neyman at auriga dot ru
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18180

Reply via email to