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

[Bug ada/13142] New: gnat1 generating call to library 'setjmp', not using __buitin_setjmp


Sometime between 20031105 and 20031115 gnat1.exe started generating a call
to 'setjmp' libarary function rather than using __builtin_setjmp

Example: Building the following

==============================
procedure Gtask is
   task Task_Type;
   task body Task_type is
   begin
      null;
   end Task_type;
begin
   null;
end Gtask;
==============================

fails with:


D:\develop\bugs>gnatmake gtask.adb 
gcc -c gtask.adb
gnatbind -x gtask.ali
gnatlink gtask.ali
./gtask.o(.text+0x179):gtask.adb: undefined reference to `setjmp'
./gtask.o(.text+0x23b):gtask.adb: undefined reference to `setjmp'
gnatlink: cannot call D:\MINGW\BIN\gcc.exe
gnatmake: *** link failed.


D:\develop\bugs>gcc -v 
Reading specs from D:/MINGW/BIN/../lib/gcc/mingw32/3.4/specs
Configured with: ../gcc/configure --host=mingw32 --build=mingw32 --
target=mingw32 --prefix=/mingw --enable-threads --disable-nls --enable-
languages=c,ada,c++ --disable-win32-registry --disable-shared --enable-sjlj-
exceptions
Thread model: win32
gcc version 3.4 20031120 (experimental)

mingw runtime does not have a library function 'setjmp', but has _setjmp,
hence the unresolved symbol. (setjmp is defined as a macro as per ISO C)

The following change to ada/utils.c restores the behaviour of generating
__builtin_setjmp code, producing essentially same assembly code as did
gnat1.exe as at 20031105.

Index: utils.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/utils.c,v
retrieving revision 1.38
diff -c -3 -p -r1.38 utils.c
*** utils.c	17 Nov 2003 14:58:17 -0000	1.38
--- utils.c	20 Nov 2003 19:24:51 -0000
*************** init_gigi_decls (tree long_long_float_ty
*** 675,681 ****
       a jmpbuf.  */
    setjmp_decl
      = create_subprog_decl
!       (get_identifier ("setjmp"), NULL_TREE,
         build_function_type (integer_type_node,
  			    tree_cons (NULL_TREE,  jmpbuf_ptr_type, endlink)),
         NULL_TREE, 0, 1, 1, 0);
--- 675,681 ----
       a jmpbuf.  */
    setjmp_decl
      = create_subprog_decl
!       (get_identifier ("__builtin_setjmp"), NULL_TREE,
         build_function_type (integer_type_node,
  			    tree_cons (NULL_TREE,  jmpbuf_ptr_type, endlink)),
         NULL_TREE, 0, 1, 1, 0);



I don't know why the behaviour has changed. Could this be involved?

2003-11-13  Jan Hubicka  <jh@suse.cz>

	PR opt/12275
	* c-decl.c (finish_decl): Use change_decl_assembler_name.
	* c-pragma.c (handle_pragma_redefine_extname): Likewise.
	* varasm.c (make_decl_rtl): Likewise.
	* cgraph.c (change_decl_assembler_name): New function.
	* tree.h (set_decl_assembler_name): Kill dead declaration.
	(change_decl_assembler_name): Declare.

-- 
           Summary: gnat1 generating call to library 'setjmp', not using
                    __buitin_setjmp
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dannysmith at gcc dot gnu dot org
                CC: charlet at act-europe dot fr,gcc-bugs at gcc dot gnu dot
                    org
 GCC build triplet: i686-pc-mingw32
  GCC host triplet: i686-pc-mingw32
GCC target triplet: i686-pc-mingw32


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


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