This is the mail archive of the 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]

cross compile & exceptions


I'm trying to migrate from gcc4.5.2 to gcc4.7.3. 

Here are a part of my makefile to build gcc (same config used with gcc4.5.2 and gcc4.7.3) :

cd $(GCC_OBJDIR); CFLAGS="-g -O0" $(GCC_SRCDIR)/configure 

make -C $(GCC_OBJDIR) all-gcc

make -C $(GCC_OBJDIR) install-gcc

The c++ (and not c) compiler produced segmentation fault on very small source only when I use default option -O0

cmd : pgcc test.cpp -S

src :
extern void bar(int *);
void toto () {
  int tmp;
  bar (&tmp);

Looking at the dumps I noticed in test.cpp.152r.rtl_eh that a bad RTL SET is generated inside a bunch of rtl dealing with exception.

(insn 19 20 12 5 (set (reg:SI 131)
        (reg:SI -1)) -1                                        <<<--- REG -1 is invalid

(insn 12 19 13 5 (set (reg/f:SI 130 [ D.1841 ])
        (reg:SI 131)) -1

(insn 13 12 14 5 (set (reg:SI 4 $C4)
        (reg/f:SI 130 [ D.1841 ])) -1

(call_insn 14 13 15 5 (parallel [
            (call (mem:SI (symbol_ref:SI ("_Unwind_Resume") [flags 0x41]  <function_decl 0x2b1caf9cfd00 __builtin_unwind_resume>) [0 __builtin_unwind_resume S4 A32])
                (const_int 0 [0]))
            (clobber (reg:SI 1 $C1))
        ]) -1

I don't want need/want exceptions on my port and it seems that -00 always produce some extra code to handle exception in c++. That was not the normal behaviour of gcc4.5.2. 

I don't see any good configure option but I tried --enable-sjlj-exceptions to see the result. The segmentation fault disappears but extra code to call _Unwind_SjLj_Register is produced (with a save of all registers in function prologue ...), that's not what I wanted.  Configure using --disable-sjlj-exceptions produce the same segmentation described above.

I also tried to compile my test with -fno-exceptions. It produces the result I expected with no error and no extra code equivalent to the gcc4.5.2 without options.

Something new in gcc4.7.3 has to be configured to disable exceptions by default ?

I noticed a change of behaviour on -fomit-frame-pointer between 4.5.2 & 4.7.3 (described in my previous post). gcc4.5.2 behaviour was exactly what I wanted (fomit-frame-pointer & fno-exceptions by default) how to obtain that with 4.7.3  ?



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