Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

CBE fails if __sigsetjmp used #1124

Closed Quuxplusone closed 12 years ago

Quuxplusone commented 17 years ago
Bugzilla Link PR1124
Status RESOLVED WONTFIX
Importance P normal
Reported by Reid Spencer (rspencer@reidspencer.com)
Reported on 2007-01-19 19:15:41 -0800
Last modified on 2012-03-26 05:57:07 -0700
Version 1.0
Hardware All All
CC anton@korobeynikov.info, benny.kra@gmail.com, edwin+bugs@etorok.eu, evan.cheng@apple.com, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
gcc Output/400.perlbench.cbe.c   -lm  -O3 -fno-strict-aliasing -O2 -fno-inline
-o Output/400.perlbench.cbe
Output/400.perlbench.cbe.c:2274: error: conflicting types for ‘__sigsetjmp’

/usr/include/setjmp.h:58: error: previous declaration of ‘__sigsetjmp’ was here

Output/400.perlbench.cbe.c:2291: error: conflicting types for ‘siglongjmp’

/usr/include/setjmp.h:109: error: previous declaration of ‘siglongjmp’ was here

This is occurring because the program defines __sigsetjmp one way but it is also
defined in setjmp.h, differently. The CBE needs to include setjmp.h for its own
uses. Perhaps the thing to do is have the CBE just emit the declarations it
needs and not include setjmp.h.

This appears to be a Linux specific problem.

This is currently causing failures for:
   External/SPEC/CINT2006/400.perlbench
   External/SPEC/CINT2006/403.gcc
Quuxplusone commented 17 years ago
CBE turns the program's definition of __sigsetjmp into this:

struct l_struct_2E___jmp_buf_tag {
  unsigned int field0[6];
  unsigned int field1;
  struct l_struct_2E___sigset_t field2;
};

unsigned int __sigsetjmp(struct l_struct_2E___jmp_buf_tag *, unsigned int );

The setjmp.h function defines it this way:

typedef struct __jmp_buf_tag    /* C++ doesn't like tagless structs.  */
  {
    /* NOTE: The machine-dependent definitions of `__sigsetjmp'
       assume that a `jmp_buf' begins with a `__jmp_buf' and that
       `__mask_was_saved' follows it.  Do not move these members
       or add others before it.  */
    __jmp_buf __jmpbuf;         /* Calling environment.  */
    int __mask_was_saved;       /* Saved the signal mask?  */
    __sigset_t __saved_mask;    /* Saved signal mask.  */
  } jmp_buf[1];
extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask) __THROW;
Quuxplusone commented 17 years ago

This also occurs on darwin/x86.

Quuxplusone commented 17 years ago
Maybe we should do the opposite? Include setjmp.h and just don't emit
declarations for sigsetjmp and friends?
Quuxplusone commented 17 years ago
You are then at the mercy of the contents of setjmp.h which can vary widely
across platforms. We need to invoke any setjmp/longjmp the way it was defined in
the headers of the compiled source program, not in the headers of the system
compiling the CBE output.

IOW, we need to inject our use of setjmp, etc. *as if* setjmp.h had been
#included in the source.
Quuxplusone commented 16 years ago

This still occurs.

Quuxplusone commented 15 years ago

_Bug 2858 has been marked as a duplicate of this bug._

Quuxplusone commented 12 years ago

The C backend was removed from svn trunk and is no longer maintained. Closing the bug.