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 Path: g2news1.google.com!news2.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!news-stoc.telia.net!217.209.241.210.MISMATCH!news-stod.telia.net!telia.net!masternews.telia.net.!newsc.telia.net.POSTED!not-for-mail From: =?ISO-8859-1?Q?Bj=F6rn_Persson?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1) Gecko/20031114 X-Accept-Language: sv, sv-se, sv-fi, en-gb, en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: STORAGE_ERROR in adainit References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Message-ID: Date: Tue, 17 Aug 2004 21:37:11 GMT NNTP-Posting-Host: 217.209.116.179 X-Complaints-To: abuse@telia.com X-Trace: newsc.telia.net 1092778631 217.209.116.179 (Tue, 17 Aug 2004 23:37:11 CEST) NNTP-Posting-Date: Tue, 17 Aug 2004 23:37:11 CEST Organization: Telia Internet Xref: g2news1.google.com comp.lang.ada:2791 Date: 2004-08-17T21:37:11+00:00 List-Id: James Alan Farrell wrote: > On Thu, 12 Aug 2004 21:15:01 GMT, Bj=F6rn Persson > wrote: >=20 >>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=20 >>clash. GCC-Gnat 3.4 detects it in the following test case: >=20 > 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. Yes, I get the same error messages when the main program is in C: file clash_test_2_ada.ads: package Clash_Test_2_Ada is end Clash_Test_2_Ada; file clash_test_2_c.c: void program_error() {} int main(int argc, char** argv) { adainit(); program_error(); adafinal(); return 0; } $ gcc -c clash_test_2_c.c $ gnatmake clash_test_2_ada gcc -c clash_test_2_ada.ads $ gnatbind -n clash_test_2_ada.ali $ LANG=3Den_US gnatlink clash_test_2_ada.ali clash_test_2_c.o /home/bjorn/ada/gcc-3.4.0-inst/lib/gcc/i686-pc-linux-gnu/3.4.0/adalib/lib= gnat.a(s-stalib.o)(.data+0x78):/home/bjorn/ada/gcc-3.4.0-objdir/gcc/ada/r= ts/s-stalib.adb:104:=20 multiple definition of `program_error' clash_test_2_c.o(.text+0x0): first defined here /usr/bin/ld: Warning: size of symbol `program_error' changed from 5 in=20 clash_test_2_c.o to 24 in=20 /home/bjorn/ada/gcc-3.4.0-inst/lib/gcc/i686-pc-linux-gnu/3.4.0/adalib/lib= gnat.a(s-stalib.o) /usr/bin/ld: Warning: type of symbol `program_error' changed from 2 to 1 = in=20 /home/bjorn/ada/gcc-3.4.0-inst/lib/gcc/i686-pc-linux-gnu/3.4.0/adalib/lib= gnat.a(s-stalib.o) collect2: ld returned 1 exit status gnatlink: cannot call /home/bjorn/ada/gcc-3.4.0-inst/bin/gcc > 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). So the difference is that you get a warning but an executable is=20 produced, while for me, Gnatlink treats the clash as a fatal error and=20 refuses to produce an executable. > 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. While I don't know what that warning is about, I'd recommend that you=20 fix it. It may well be another fatal error. --=20 Bj=F6rn Persson PGP key A88682FD omb jor ers @sv ge. r o.b n.p son eri nu