From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ec31fb6eda682268 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII From: James Alan Farrell Newsgroups: comp.lang.ada Subject: Re: STORAGE_ERROR in adainit Date: Fri, 13 Aug 2004 09:36:55 -0400 Message-ID: References: X-Newsreader: Forte Free Agent 2.0/32.652 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit NNTP-Posting-Host: fw.grammatech.com X-Trace: newsfeed.slurp.net 1092404280 209.4.89.67 (13 Aug 2004 08:38:00 -0500) X-Original-NNTP-Posting-Host: 209.4.89.67 Path: g2news1.google.com!news1.google.com!news.glorb.com!news.moat.net!newsfeed.slurp.net!not-for-mail Xref: g2news1.google.com comp.lang.ada:2717 Date: 2004-08-13T09:36:55-04:00 List-Id: On Thu, 12 Aug 2004 21:15:01 GMT, Bj�rn Persson wrote: >James Alan Farrell wrote: > >> I think I've found the problem: >> >> There was a function in a C library called program_error. I changed >> the name to a_program_error and the storage_error went away. > >It's probably a bug in your compiler that it doesn't detect the name >clash. GCC-Gnat 3.4 detects it in the following test case: > > >file clash_test_c.c: > >void program_error() {} > >void proc() { > program_error(); >} > > >file clash_test_ada.adb: > >procedure Clash_Test_Ada is > > procedure Proc; > pragma Import (C, Proc, "proc"); > >begin > Proc; >end Clash_Test_Ada; > > >$ gcc -c clash_test_c.c >$ LANG=en_US gnatmake clash_test_ada -largs clash_test_c.o >gnatbind -x clash_test_ada.ali >gnatlink clash_test_ada.ali clash_test_c.o >/home/bjorn/ada/gcc-3.4.0-inst/lib/gcc/i686-pc-linux-gnu/3.4.0/adalib/libgnat.a(s-stalib.o)(.data+0x78):/home/bjorn/ada/gcc-3.4.0-objdir/gcc/ada/rts/s-stalib.adb:104: >multiple definition of `program_error' >clash_test_c.o(.text+0x0): first defined here >/usr/bin/ld: Warning: size of symbol `program_error' changed from 5 in >clash_test_c.o to 24 in >/home/bjorn/ada/gcc-3.4.0-inst/lib/gcc/i686-pc-linux-gnu/3.4.0/adalib/libgnat.a(s-stalib.o) >/usr/bin/ld: Warning: type of symbol `program_error' changed from 2 to 1 >in >/home/bjorn/ada/gcc-3.4.0-inst/lib/gcc/i686-pc-linux-gnu/3.4.0/adalib/libgnat.a(s-stalib.o) >collect2: ld returned 1 exit status >gnatlink: cannot call /home/bjorn/ada/gcc-3.4.0-inst/bin/gcc >gnatmake: *** link failed. Does it detect the problem if the main in C and Clash_Test_Ada is exported to C? That is the problem I am having. I suspect what you show here is easier for the compiler to detect than the other way around. I found the problem by creating a small test program. When I did that I got a linker warning pointing to program_error (indicating in fact that it is used as data in one place and as a function in another place). In the production program I am getting an unrelated linker warning, but I think for some reason that warning was preventing the warning that I needed from being displayed. Thanks to Ludovic for posting that list. That will be a big help. Thanks to Stephe for saying that so I don't have too! James Alan Farrell GrammaTech, inc.