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

Ada: jmp_buf size incorrect


Hello,

since the recent big Ada merge, Ada is broken on s390.

I've just understood one of the reasons: the merge introduced
code in tree_transform (trans.c) that generates a call to setjmp.

This exposed an apparently long-standing bug in the definition
of the 'jmp_buf' data type:  init_gigi_decls (utils.c) has:

  /* Make the types and functions used for exception processing.    */
  jmpbuf_type
    = build_array_type (gnat_type_for_mode (Pmode, 0),
                        build_index_type (build_int_2 (5, 0)));
  pushdecl (build_decl (TYPE_DECL, get_identifier ("JMPBUF_T"), jmpbuf_type));
  jmpbuf_ptr_type = build_pointer_type (jmpbuf_type);

which may happen to work on i386, but causes memory overwrites
on all platforms where jmp_buf is larger than 5 pointers.
(B.t.w. even on i386, the jmp_buf size is 6 words ...)

How's this supposed to work?  If you call the platform's setjmp,
you need to provide a proper jmp_buf ...   (Maybe there's some
confusion with gcc's __builtin_setjmp which indeed always uses
a buffer with the size of 5 pointers?)

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  weigand@informatik.uni-erlangen.de


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