Message ID | CALsyMRjEvPie12SysH+XtWeObpdDgPTBjj-s8iScMmRt8dtgAQ@mail.gmail.com |
---|---|
State | New |
Headers | show |
On 10/25/14 04:20, Anthony Brandon wrote: > Hi, > > Sorry for the delay. Here are the updated diff and changelog. > > gcc/testsuite/ChangeLog: > > 2014-10-25 Anthony Brandon <anthony.brandon@gmail.com> > > PR driver/36312 > * gcc.misc-tests/output.exp: New test case for identical input and > output files. > > include/ChangeLog: > > 2014-10-25 Anthony Brandon <anthony.brandon@gmail.com> > > PR driver/36312 > * filenames.h: Add prototype for canonical_filename_eq. > > gcc/ChangeLog: > > 2014-10-25 Anthony Brandon <anthony.brandon@gmail.com> > > PR driver/36312 > * diagnostic-core.h: Add prototype for fatal_error. > * diagnostic.c (fatal_error): New function fatal_error. > * gcc.c (store_arg): Remove have_o_argbuf_index. > (process_command): Check if input and output files are the same. > * toplev.c (init_asm_output): Check if input and output files are the same. > > libiberty/ChangeLog: > > 2014-10-25 Anthony Brandon <anthony.brandon@gmail.com> > > PR driver/36312 > * filename_cmp.c (canonical_filename_eq): New function to check if > file names are the same. > * functions.texi: Updated with documentation for new function. This is fine for the trunk. Please install. Thanks, Jeff
On 4 November 2014 23:40, Jeff Law <law@redhat.com> wrote: > On 10/25/14 04:20, Anthony Brandon wrote: >> >> Hi, >> >> Sorry for the delay. Here are the updated diff and changelog. >> >> gcc/testsuite/ChangeLog: >> >> 2014-10-25 Anthony Brandon <anthony.brandon@gmail.com> >> >> PR driver/36312 >> * gcc.misc-tests/output.exp: New test case for identical input and >> output files. >> >> include/ChangeLog: >> >> 2014-10-25 Anthony Brandon <anthony.brandon@gmail.com> >> >> PR driver/36312 >> * filenames.h: Add prototype for canonical_filename_eq. >> >> gcc/ChangeLog: >> >> 2014-10-25 Anthony Brandon <anthony.brandon@gmail.com> >> >> PR driver/36312 >> * diagnostic-core.h: Add prototype for fatal_error. >> * diagnostic.c (fatal_error): New function fatal_error. >> * gcc.c (store_arg): Remove have_o_argbuf_index. >> (process_command): Check if input and output files are the same. >> * toplev.c (init_asm_output): Check if input and output files are the >> same. >> >> libiberty/ChangeLog: >> >> 2014-10-25 Anthony Brandon <anthony.brandon@gmail.com> >> >> PR driver/36312 >> * filename_cmp.c (canonical_filename_eq): New function to check if >> file names are the same. >> * functions.texi: Updated with documentation for new function. > > This is fine for the trunk. Please install. > > Thanks, > Jeff > I committed this as r217149. Anthony, Thanks! Cheers, Manuel.
> 2014-10-25 Anthony Brandon <anthony.brandon@gmail.com> > > PR driver/36312 > * diagnostic-core.h: Add prototype for fatal_error. > * diagnostic.c (fatal_error): New function fatal_error. > * gcc.c (store_arg): Remove have_o_argbuf_index. > (process_command): Check if input and output files are the same. > * toplev.c (init_asm_output): Check if input and output files are the > same. This breaks the build of the shared Ada library: rm -f rts/libgna*.so cd rts; `echo "/home/eric/build/gcc/native/./gcc/xgcc - B/home/eric/build/gcc/native/./gcc/ -B/home/eric/install/gcc/x86_64-suse- linux/bin/ -B/home/eric/install/gcc/x86_64-suse-linux/lib/ -isystem /home/eric/install/gcc/x86_64-suse-linux/include -isystem /home/eric/install/gcc/x86_64-suse-linux/sys-include " \ | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` - shared -g -O2 \ -fpic \ -o libgnat-5.0.so \ a-assert.o a-btgbso.o a-calari.o a-calcon.o a-caldel.o a-calend.o a- calfor.o a-catizo.o a-cbdlli.o a-cbhama.o a-cbhase.o a-cbmutr.o a-cborma.o a- cborse.o a-cbprqu.o a-cbsyqu.o a-cdlili.o a-cfdlli.o a-cfhama.o a-cfhase.o a- cfinve.o a-cforma.o a-cforse.o a-cgaaso.o a-cgarso.o a-cgcaso.o a-chacon.o a- chahan.o a-charac.o a-chlat1.o a-chlat9.o a-chtgbk.o a-chtgbo.o a-chtgke.o a- chtgop.o a-chzla1.o a-chzla9.o a-cidlli.o a-cihama.o a-cihase.o a-cimutr.o a- ciorma.o a-ciormu.o a-ciorse.o a-clrefi.o a-coboho.o a-cobove.o a-cofove.o a- cogeso.o a-cohama.o a-cohase.o a-cohata.o a-coinho.o a-coinve.o a-colien.o a- colire.o a-comlin.o a-comutr.o a-contai.o a-convec.o a-coorma.o a-coormu.o a- coorse.o a-coprnu.o a-coteio.o a-crbltr.o a-crbtgk.o a-crbtgo.o a-crdlli.o a- csquin.o a-cuprqu.o a-cusyqu.o a-cwila1.o a-cwila9.o a-decima.o a-diocst.o a- direct.o a-direio.o a-dirval.o a-einuoc.o a-elchha.o a-envvar.o a-except.o a- exctra.o a-finali.o a-flteio.o a-fwteio.o a-fzteio.o a-inteio.o a-ioexce.o a- iteint.o a-iwteio.o a-izteio.o a-lcteio.o a-lfteio.o a-lfwtio.o a-lfztio.o a- liteio.o a-liwtio.o a-liztio.o a-llctio.o a-llftio.o a-llfwti.o a-llfzti.o a- llitio.o a-lliwti.o a-llizti.o a-locale.o a-ncelfu.o a-ngcefu.o a-ngcoar.o a- ngcoty.o a-ngelfu.o a-ngrear.o a-nlcefu.o a-nlcoar.o a-nlcoty.o a-nlelfu.o a- nllcar.o a-nllcef.o a-nllcty.o a-nllefu.o a-nllrar.o a-nlrear.o a-nscefu.o a- nscoty.o a-nselfu.o a-nucoar.o a-nucoty.o a-nudira.o a-nuelfu.o a-nuflra.o a- numaux.o a-numeri.o a-nurear.o a-rbtgbk.o a-rbtgbo.o a-rbtgso.o a-sbecin.o a- sbhcin.o a-sblcin.o a-scteio.o a-secain.o a-sequio.o a-sfecin.o a-sfhcin.o a- sflcin.o a-sfteio.o a-sfwtio.o a-sfztio.o a-shcain.o a-siocst.o a-siteio.o a- siwtio.o a-siztio.o a-slcain.o a-ssicst.o a-ssitio.o a-ssiwti.o a-ssizti.o a- stboha.o a-stfiha.o a-stmaco.o a-storio.o a-strbou.o a-stream.o a-strfix.o a- strhas.o a-string.o a-strmap.o a-strsea.o a-strsup.o a-strunb.o a-ststio.o a- stunau.o a-stunha.o a-stuten.o a-stwibo.o a-stwifi.o a-stwiha.o a-stwima.o a- stwise.o a-stwisu.o a-stwiun.o a-stzbou.o a-stzfix.o a-stzhas.o a-stzmap.o a- stzsea.o a-stzsup.o a-stzunb.o a-suecin.o a-suenco.o a-suenst.o a-suewst.o a- suezst.o a-suhcin.o a-sulcin.o a-suteio.o a-swbwha.o a-swfwha.o a-swmwco.o a- swunau.o a-swuwha.o a-swuwti.o a-szbzha.o a-szfzha.o a-szmzco.o a-szunau.o a- szuzha.o a-szuzti.o a-tags.o a-teioed.o a-textio.o a-tgdico.o a-tiboio.o a- ticoau.o a-ticoio.o a-tideau.o a-tideio.o a-tienau.o a-tienio.o a-tifiio.o a- tiflau.o a-tiflio.o a-tigeau.o a-tiinau.o a-tiinio.o a-timoau.o a-timoio.o a- tiocst.o a-tirsfi.o a-titest.o a-tiunio.o a-unccon.o a-uncdea.o a-undesu.o a- wichha.o a-wichun.o a-widcha.o a-witeio.o a-wrstfi.o a-wtcoau.o a-wtcoio.o a- wtcstr.o a-wtdeau.o a-wtdeio.o a-wtedit.o a-wtenau.o a-wtenio.o a-wtfiio.o a- wtflau.o a-wtflio.o a-wtgeau.o a-wtinau.o a-wtinio.o a-wtmoau.o a-wtmoio.o a- wttest.o a-wwboio.o a-wwunio.o a-zchara.o a-zchhan.o a-zchuni.o a-zrstfi.o a- ztcoau.o a-ztcoio.o a-ztcstr.o a-ztdeau.o a-ztdeio.o a-ztedit.o a-ztenau.o a- ztenio.o a-ztexio.o a-ztfiio.o a-ztflau.o a-ztflio.o a-ztgeau.o a-ztinau.o a- ztinio.o a-ztmoau.o a-ztmoio.o a-zttest.o a-zzboio.o a-zzunio.o ada.o calendar.o directio.o g-arrspl.o g-awk.o g-bubsor.o g-busora.o g-busorg.o g- byorma.o g-bytswa.o g-calend.o g-casuti.o g-catiio.o g-cgi.o g-cgicoo.o g- cgideb.o g-comlin.o g-comver.o g-crc32.o g-ctrl_c.o g-curexc.o g-debpoo.o g- debuti.o g-decstr.o g-deutst.o g-diopit.o g-dirope.o g-dynhta.o g-dyntab.o g- encstr.o g-enutst.o g-excact.o g-except.o g-exctra.o s-exctra.o g-expect.o g- exptty.o g-flocon.o g-forstr.o g-heasor.o g-hesora.o g-hesorg.o g-htable.o g- io.o g-io_aux.o g-locfil.o g-mbdira.o g-mbflra.o g-md5.o g-memdum.o g-moreex.o g-os_lib.o g-pehage.o g-rannum.o g-regexp.o g-regpat.o g-rewdat.o g-sechas.o g-sehamd.o g-sehash.o g-sercom.o g-sestin.o g-sha1.o g-sha224.o g-sha256.o g- sha384.o g-sha512.o g-shsh32.o g-shsh64.o g-shshco.o g-souinf.o g-spchge.o g- speche.o g-spipat.o g-spitbo.o g-sptabo.o g-sptain.o g-sptavs.o g-string.o g- strspl.o g-table.o g-tasloc.o g-timsta.o g-traceb.o g-trasym.o s-trasym.o g- tty.o g-u3spch.o g-utf_32.o g-wispch.o g-wistsp.o g-zspche.o g-zstspl.o gnat.o i-c.o i-cexten.o i-cobol.o i-cpoint.o i-cstrea.o i-cstrin.o i-fortra.o i- pacdec.o interfac.o ioexcept.o machcode.o s-addima.o s-addope.o s-arit64.o s- assert.o s-atacco.o s-atocou.o s-atopri.o s-auxdec.o s-bignum.o s-bitops.o s- boarop.o s-bytswa.o s-carsi8.o s-carun8.o s-casi16.o s-casi32.o s-casi64.o s- casuti.o s-caun16.o s-caun32.o s-caun64.o s-chepoo.o s-commun.o s-conca2.o s- conca3.o s-conca4.o s-conca5.o s-conca6.o s-conca7.o s-conca8.o s-conca9.o s- crc32.o s-crtl.o s-diflio.o s-diinio.o s-dim.o s-dimkio.o s-dimmks.o s- direio.o s-dmotpr.o s-dsaser.o s-elaall.o s-excdeb.o s-except.o s-exctab.o s- exnint.o s-exnllf.o s-exnlli.o s-expint.o s-explli.o s-expllu.o s-expmod.o s- expuns.o s-fatflt.o s-fatgen.o s-fatlfl.o s-fatllf.o s-fatsfl.o s-ficobl.o s- filatt.o s-fileio.o s-finmas.o s-finroo.o s-flocon.o s-fore.o s-gearop.o s- geveop.o s-gloloc.o s-htable.o s-imenne.o s-imgbiu.o s-imgboo.o s-imgcha.o s- imgdec.o s-imgenu.o s-imgint.o s-imgllb.o s-imglld.o s-imglli.o s-imgllu.o s- imgllw.o s-imgrea.o s-imguns.o s-imgwch.o s-imgwiu.o s-io.o s-llflex.o s- maccod.o s-mantis.o s-mastop.o s-memcop.o s-memory.o s-multip.o s-os_lib.o s- oscons.o s-osprim.o s-pack03.o s-pack05.o s-pack06.o s-pack07.o s-pack09.o s- pack10.o s-pack11.o s-pack12.o s-pack13.o s-pack14.o s-pack15.o s-pack17.o s- pack18.o s-pack19.o s-pack20.o s-pack21.o s-pack22.o s-pack23.o s-pack24.o s- pack25.o s-pack26.o s-pack27.o s-pack28.o s-pack29.o s-pack30.o s-pack31.o s- pack33.o s-pack34.o s-pack35.o s-pack36.o s-pack37.o s-pack38.o s-pack39.o s- pack40.o s-pack41.o s-pack42.o s-pack43.o s-pack44.o s-pack45.o s-pack46.o s- pack47.o s-pack48.o s-pack49.o s-pack50.o s-pack51.o s-pack52.o s-pack53.o s- pack54.o s-pack55.o s-pack56.o s-pack57.o s-pack58.o s-pack59.o s-pack60.o s- pack61.o s-pack62.o s-pack63.o s-parame.o s-parint.o s-pooglo.o s-pooloc.o s- poosiz.o s-powtab.o s-purexc.o s-rannum.o s-ransee.o s-regexp.o s-regpat.o s- restri.o s-rident.o s-rpc.o s-scaval.o s-secsta.o s-sequio.o s-shasto.o s- soflin.o s-spsufi.o s-stache.o s-stalib.o s-stausa.o s-stchop.o s-stoele.o s- stopoo.o s-stposu.o s-stratt.o s-strhas.o s-string.o s-ststop.o s-tasloc.o s- traceb.o s-traces.o s-traent.o s-unstyp.o s-utf_32.o s-valboo.o s-valcha.o s- valdec.o s-valenu.o s-valint.o s-vallld.o s-vallli.o s-valllu.o s-valrea.o s- valuns.o s-valuti.o s-valwch.o s-veboop.o s-vector.o s-vercon.o s-wchcnv.o s- wchcon.o s-wchjis.o s-wchstw.o s-wchwts.o s-widboo.o s-widcha.o s-widenu.o s- widlli.o s-widllu.o s-widwch.o s-wwdcha.o s-wwdenu.o s-wwdwch.o sequenio.o system.o text_io.o unchconv.o unchdeal.o g-allein.o g-alleve.o g-altcon.o g- altive.o g-alveop.o g-alvety.o g-alvevi.o g-soccon.o g-socket.o g-socthi.o g- soliop.o g-sothco.o g-sse.o g-ssvety.o g-cppexc.o s-excmac.o adadecode.o adaint.o argv.o aux-io.o cal.o cio.o cstreams.o ctrl_c.o env.o errno.o exit.o expect.o final.o init.o initialize.o locales.o mkdir.o raise.o seh_init.o socket.o sysdep.o targext.o terminals.o tracebak.o raise-gcc.o \ -Wl,-soname,libgnat-5.0.so \ -ldl -lm xgcc: fatal error: output file libgnat-5.0.so is the same as input file compilation terminated. make[4]: *** [gnatlib-shared-default] Error 1 make[4]: Leaving directory `/home/eric/build/gcc/native/gcc/ada' make[3]: *** [gnatlib-shared-dual] Error 2 make[3]: Leaving directory `/home/eric/build/gcc/native/gcc/ada' make[2]: *** [gnatlib-shared] Error 2 make[2]: Leaving directory `/home/eric/build/gcc/native/gcc/ada' make[1]: *** [gnatlib-shared] Error 2 make[1]: Leaving directory `/home/eric/build/gcc/native/x86_64-suse- linux/libada' make: *** [all-target-libada] Error 2
On 5 November 2014 21:57, Eric Botcazou <ebotcazou@adacore.com> wrote: >> 2014-10-25 Anthony Brandon <anthony.brandon@gmail.com> >> >> PR driver/36312 >> * diagnostic-core.h: Add prototype for fatal_error. >> * diagnostic.c (fatal_error): New function fatal_error. >> * gcc.c (store_arg): Remove have_o_argbuf_index. >> (process_command): Check if input and output files are the same. >> * toplev.c (init_asm_output): Check if input and output files are the >> same. > > This breaks the build of the shared Ada library: Sorry for the breakage. I guess Anthony didn't configure with --enable-languages=all,ada. It is a typical mistake I have myself done in the past. Since the fix is not obvious to me and I'm not sure how much time Anthony would require to find a fix, I reverted the patch for now. Cheers, Manuel.
> Sorry for the breakage. I guess Anthony didn't configure with > --enable-languages=all,ada. It is a typical mistake I have myself done > in the past. Since the fix is not obvious to me and I'm not sure how > much time Anthony would require to find a fix, I reverted the patch > for now. Thanks. I'm under the impression that --enable-languages=all will really build all the languages now.
On 5 November 2014 23:39, Eric Botcazou <ebotcazou@adacore.com> wrote: >> Sorry for the breakage. I guess Anthony didn't configure with >> --enable-languages=all,ada. It is a typical mistake I have myself done >> in the past. Since the fix is not obvious to me and I'm not sure how >> much time Anthony would require to find a fix, I reverted the patch >> for now. > > Thanks. I'm under the impression that --enable-languages=all will really > build all the languages now. I guess one still needs to know/remember to use --enable-languages at all. I added this tip to https://gcc.gnu.org/wiki/GettingStarted#Basics:_Contributing_to_GCC_in_10_easy_steps Cheers, Manuel.
On Wed, 5 Nov 2014, Manuel López-Ibáñez wrote: > Sorry for the breakage. I guess Anthony didn't configure with > --enable-languages=all,ada. It is a typical mistake I have myself done > in the past. Since the fix is not obvious to me and I'm not sure how > much time Anthony would require to find a fix, I reverted the patch > for now. When reverting a patch, please remember to reopen any bugs that were fixed by that patch.
On 6 November 2014 00:33, Joseph Myers <joseph@codesourcery.com> wrote: > On Wed, 5 Nov 2014, Manuel López-Ibáñez wrote: > >> Sorry for the breakage. I guess Anthony didn't configure with >> --enable-languages=all,ada. It is a typical mistake I have myself done >> in the past. Since the fix is not obvious to me and I'm not sure how >> much time Anthony would require to find a fix, I reverted the patch >> for now. > > When reverting a patch, please remember to reopen any bugs that were fixed > by that patch. I was pretty sure I had done so, but it seems I must have only planned to do it. Done now. Cheers, Manuel.
It looks like -soname, and libgnat-5.0.so both end up in the infiles array. I'm not sure if that's supposed to happen or not. On Wed, Nov 5, 2014 at 9:57 PM, Eric Botcazou <ebotcazou@adacore.com> wrote: >> 2014-10-25 Anthony Brandon <anthony.brandon@gmail.com> >> >> PR driver/36312 >> * diagnostic-core.h: Add prototype for fatal_error. >> * diagnostic.c (fatal_error): New function fatal_error. >> * gcc.c (store_arg): Remove have_o_argbuf_index. >> (process_command): Check if input and output files are the same. >> * toplev.c (init_asm_output): Check if input and output files are the >> same. > > This breaks the build of the shared Ada library: > > rm -f rts/libgna*.so > cd rts; `echo "/home/eric/build/gcc/native/./gcc/xgcc - > B/home/eric/build/gcc/native/./gcc/ -B/home/eric/install/gcc/x86_64-suse- > linux/bin/ -B/home/eric/install/gcc/x86_64-suse-linux/lib/ -isystem > /home/eric/install/gcc/x86_64-suse-linux/include -isystem > /home/eric/install/gcc/x86_64-suse-linux/sys-include " \ > | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'` - > shared -g -O2 \ > -fpic \ > -o libgnat-5.0.so \ > a-assert.o a-btgbso.o a-calari.o a-calcon.o a-caldel.o a-calend.o a- > calfor.o a-catizo.o a-cbdlli.o a-cbhama.o a-cbhase.o a-cbmutr.o a-cborma.o a- > cborse.o a-cbprqu.o a-cbsyqu.o a-cdlili.o a-cfdlli.o a-cfhama.o a-cfhase.o a- > cfinve.o a-cforma.o a-cforse.o a-cgaaso.o a-cgarso.o a-cgcaso.o a-chacon.o a- > chahan.o a-charac.o a-chlat1.o a-chlat9.o a-chtgbk.o a-chtgbo.o a-chtgke.o a- > chtgop.o a-chzla1.o a-chzla9.o a-cidlli.o a-cihama.o a-cihase.o a-cimutr.o a- > ciorma.o a-ciormu.o a-ciorse.o a-clrefi.o a-coboho.o a-cobove.o a-cofove.o a- > cogeso.o a-cohama.o a-cohase.o a-cohata.o a-coinho.o a-coinve.o a-colien.o a- > colire.o a-comlin.o a-comutr.o a-contai.o a-convec.o a-coorma.o a-coormu.o a- > coorse.o a-coprnu.o a-coteio.o a-crbltr.o a-crbtgk.o a-crbtgo.o a-crdlli.o a- > csquin.o a-cuprqu.o a-cusyqu.o a-cwila1.o a-cwila9.o a-decima.o a-diocst.o a- > direct.o a-direio.o a-dirval.o a-einuoc.o a-elchha.o a-envvar.o a-except.o a- > exctra.o a-finali.o a-flteio.o a-fwteio.o a-fzteio.o a-inteio.o a-ioexce.o a- > iteint.o a-iwteio.o a-izteio.o a-lcteio.o a-lfteio.o a-lfwtio.o a-lfztio.o a- > liteio.o a-liwtio.o a-liztio.o a-llctio.o a-llftio.o a-llfwti.o a-llfzti.o a- > llitio.o a-lliwti.o a-llizti.o a-locale.o a-ncelfu.o a-ngcefu.o a-ngcoar.o a- > ngcoty.o a-ngelfu.o a-ngrear.o a-nlcefu.o a-nlcoar.o a-nlcoty.o a-nlelfu.o a- > nllcar.o a-nllcef.o a-nllcty.o a-nllefu.o a-nllrar.o a-nlrear.o a-nscefu.o a- > nscoty.o a-nselfu.o a-nucoar.o a-nucoty.o a-nudira.o a-nuelfu.o a-nuflra.o a- > numaux.o a-numeri.o a-nurear.o a-rbtgbk.o a-rbtgbo.o a-rbtgso.o a-sbecin.o a- > sbhcin.o a-sblcin.o a-scteio.o a-secain.o a-sequio.o a-sfecin.o a-sfhcin.o a- > sflcin.o a-sfteio.o a-sfwtio.o a-sfztio.o a-shcain.o a-siocst.o a-siteio.o a- > siwtio.o a-siztio.o a-slcain.o a-ssicst.o a-ssitio.o a-ssiwti.o a-ssizti.o a- > stboha.o a-stfiha.o a-stmaco.o a-storio.o a-strbou.o a-stream.o a-strfix.o a- > strhas.o a-string.o a-strmap.o a-strsea.o a-strsup.o a-strunb.o a-ststio.o a- > stunau.o a-stunha.o a-stuten.o a-stwibo.o a-stwifi.o a-stwiha.o a-stwima.o a- > stwise.o a-stwisu.o a-stwiun.o a-stzbou.o a-stzfix.o a-stzhas.o a-stzmap.o a- > stzsea.o a-stzsup.o a-stzunb.o a-suecin.o a-suenco.o a-suenst.o a-suewst.o a- > suezst.o a-suhcin.o a-sulcin.o a-suteio.o a-swbwha.o a-swfwha.o a-swmwco.o a- > swunau.o a-swuwha.o a-swuwti.o a-szbzha.o a-szfzha.o a-szmzco.o a-szunau.o a- > szuzha.o a-szuzti.o a-tags.o a-teioed.o a-textio.o a-tgdico.o a-tiboio.o a- > ticoau.o a-ticoio.o a-tideau.o a-tideio.o a-tienau.o a-tienio.o a-tifiio.o a- > tiflau.o a-tiflio.o a-tigeau.o a-tiinau.o a-tiinio.o a-timoau.o a-timoio.o a- > tiocst.o a-tirsfi.o a-titest.o a-tiunio.o a-unccon.o a-uncdea.o a-undesu.o a- > wichha.o a-wichun.o a-widcha.o a-witeio.o a-wrstfi.o a-wtcoau.o a-wtcoio.o a- > wtcstr.o a-wtdeau.o a-wtdeio.o a-wtedit.o a-wtenau.o a-wtenio.o a-wtfiio.o a- > wtflau.o a-wtflio.o a-wtgeau.o a-wtinau.o a-wtinio.o a-wtmoau.o a-wtmoio.o a- > wttest.o a-wwboio.o a-wwunio.o a-zchara.o a-zchhan.o a-zchuni.o a-zrstfi.o a- > ztcoau.o a-ztcoio.o a-ztcstr.o a-ztdeau.o a-ztdeio.o a-ztedit.o a-ztenau.o a- > ztenio.o a-ztexio.o a-ztfiio.o a-ztflau.o a-ztflio.o a-ztgeau.o a-ztinau.o a- > ztinio.o a-ztmoau.o a-ztmoio.o a-zttest.o a-zzboio.o a-zzunio.o ada.o > calendar.o directio.o g-arrspl.o g-awk.o g-bubsor.o g-busora.o g-busorg.o g- > byorma.o g-bytswa.o g-calend.o g-casuti.o g-catiio.o g-cgi.o g-cgicoo.o g- > cgideb.o g-comlin.o g-comver.o g-crc32.o g-ctrl_c.o g-curexc.o g-debpoo.o g- > debuti.o g-decstr.o g-deutst.o g-diopit.o g-dirope.o g-dynhta.o g-dyntab.o g- > encstr.o g-enutst.o g-excact.o g-except.o g-exctra.o s-exctra.o g-expect.o g- > exptty.o g-flocon.o g-forstr.o g-heasor.o g-hesora.o g-hesorg.o g-htable.o g- > io.o g-io_aux.o g-locfil.o g-mbdira.o g-mbflra.o g-md5.o g-memdum.o g-moreex.o > g-os_lib.o g-pehage.o g-rannum.o g-regexp.o g-regpat.o g-rewdat.o g-sechas.o > g-sehamd.o g-sehash.o g-sercom.o g-sestin.o g-sha1.o g-sha224.o g-sha256.o g- > sha384.o g-sha512.o g-shsh32.o g-shsh64.o g-shshco.o g-souinf.o g-spchge.o g- > speche.o g-spipat.o g-spitbo.o g-sptabo.o g-sptain.o g-sptavs.o g-string.o g- > strspl.o g-table.o g-tasloc.o g-timsta.o g-traceb.o g-trasym.o s-trasym.o g- > tty.o g-u3spch.o g-utf_32.o g-wispch.o g-wistsp.o g-zspche.o g-zstspl.o gnat.o > i-c.o i-cexten.o i-cobol.o i-cpoint.o i-cstrea.o i-cstrin.o i-fortra.o i- > pacdec.o interfac.o ioexcept.o machcode.o s-addima.o s-addope.o s-arit64.o s- > assert.o s-atacco.o s-atocou.o s-atopri.o s-auxdec.o s-bignum.o s-bitops.o s- > boarop.o s-bytswa.o s-carsi8.o s-carun8.o s-casi16.o s-casi32.o s-casi64.o s- > casuti.o s-caun16.o s-caun32.o s-caun64.o s-chepoo.o s-commun.o s-conca2.o s- > conca3.o s-conca4.o s-conca5.o s-conca6.o s-conca7.o s-conca8.o s-conca9.o s- > crc32.o s-crtl.o s-diflio.o s-diinio.o s-dim.o s-dimkio.o s-dimmks.o s- > direio.o s-dmotpr.o s-dsaser.o s-elaall.o s-excdeb.o s-except.o s-exctab.o s- > exnint.o s-exnllf.o s-exnlli.o s-expint.o s-explli.o s-expllu.o s-expmod.o s- > expuns.o s-fatflt.o s-fatgen.o s-fatlfl.o s-fatllf.o s-fatsfl.o s-ficobl.o s- > filatt.o s-fileio.o s-finmas.o s-finroo.o s-flocon.o s-fore.o s-gearop.o s- > geveop.o s-gloloc.o s-htable.o s-imenne.o s-imgbiu.o s-imgboo.o s-imgcha.o s- > imgdec.o s-imgenu.o s-imgint.o s-imgllb.o s-imglld.o s-imglli.o s-imgllu.o s- > imgllw.o s-imgrea.o s-imguns.o s-imgwch.o s-imgwiu.o s-io.o s-llflex.o s- > maccod.o s-mantis.o s-mastop.o s-memcop.o s-memory.o s-multip.o s-os_lib.o s- > oscons.o s-osprim.o s-pack03.o s-pack05.o s-pack06.o s-pack07.o s-pack09.o s- > pack10.o s-pack11.o s-pack12.o s-pack13.o s-pack14.o s-pack15.o s-pack17.o s- > pack18.o s-pack19.o s-pack20.o s-pack21.o s-pack22.o s-pack23.o s-pack24.o s- > pack25.o s-pack26.o s-pack27.o s-pack28.o s-pack29.o s-pack30.o s-pack31.o s- > pack33.o s-pack34.o s-pack35.o s-pack36.o s-pack37.o s-pack38.o s-pack39.o s- > pack40.o s-pack41.o s-pack42.o s-pack43.o s-pack44.o s-pack45.o s-pack46.o s- > pack47.o s-pack48.o s-pack49.o s-pack50.o s-pack51.o s-pack52.o s-pack53.o s- > pack54.o s-pack55.o s-pack56.o s-pack57.o s-pack58.o s-pack59.o s-pack60.o s- > pack61.o s-pack62.o s-pack63.o s-parame.o s-parint.o s-pooglo.o s-pooloc.o s- > poosiz.o s-powtab.o s-purexc.o s-rannum.o s-ransee.o s-regexp.o s-regpat.o s- > restri.o s-rident.o s-rpc.o s-scaval.o s-secsta.o s-sequio.o s-shasto.o s- > soflin.o s-spsufi.o s-stache.o s-stalib.o s-stausa.o s-stchop.o s-stoele.o s- > stopoo.o s-stposu.o s-stratt.o s-strhas.o s-string.o s-ststop.o s-tasloc.o s- > traceb.o s-traces.o s-traent.o s-unstyp.o s-utf_32.o s-valboo.o s-valcha.o s- > valdec.o s-valenu.o s-valint.o s-vallld.o s-vallli.o s-valllu.o s-valrea.o s- > valuns.o s-valuti.o s-valwch.o s-veboop.o s-vector.o s-vercon.o s-wchcnv.o s- > wchcon.o s-wchjis.o s-wchstw.o s-wchwts.o s-widboo.o s-widcha.o s-widenu.o s- > widlli.o s-widllu.o s-widwch.o s-wwdcha.o s-wwdenu.o s-wwdwch.o sequenio.o > system.o text_io.o unchconv.o unchdeal.o g-allein.o g-alleve.o g-altcon.o g- > altive.o g-alveop.o g-alvety.o g-alvevi.o g-soccon.o g-socket.o g-socthi.o g- > soliop.o g-sothco.o g-sse.o g-ssvety.o g-cppexc.o s-excmac.o adadecode.o > adaint.o argv.o aux-io.o cal.o cio.o cstreams.o ctrl_c.o env.o errno.o exit.o > expect.o final.o init.o initialize.o locales.o mkdir.o raise.o seh_init.o > socket.o sysdep.o targext.o terminals.o tracebak.o raise-gcc.o \ > -Wl,-soname,libgnat-5.0.so \ > -ldl -lm > xgcc: fatal error: output file libgnat-5.0.so is the same as input file > compilation terminated. > make[4]: *** [gnatlib-shared-default] Error 1 > make[4]: Leaving directory `/home/eric/build/gcc/native/gcc/ada' > make[3]: *** [gnatlib-shared-dual] Error 2 > make[3]: Leaving directory `/home/eric/build/gcc/native/gcc/ada' > make[2]: *** [gnatlib-shared] Error 2 > make[2]: Leaving directory `/home/eric/build/gcc/native/gcc/ada' > make[1]: *** [gnatlib-shared] Error 2 > make[1]: Leaving directory `/home/eric/build/gcc/native/x86_64-suse- > linux/libada' > make: *** [all-target-libada] Error 2 > > -- > Eric Botcazou
On 2014.11.05 at 18:32 +0100, Manuel López-Ibáñez wrote: > > I committed this as r217149. This patch causes kernel build failures when using GCC_COMPARE_DEBUG=1. "GCC_COMPARE_DEBUG=1 make CC=/var/tmp/gcc_trunk/usr/local/bin/gcc" is enough to reproduce. See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63837
diff --git a/gcc/diagnostic-core.h b/gcc/diagnostic-core.h index a8245de..2fba279 100644 --- a/gcc/diagnostic-core.h +++ b/gcc/diagnostic-core.h @@ -68,6 +68,8 @@ extern void error_n (location_t, int, const char *, const char *, ...) extern void error_at (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); extern void fatal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2) ATTRIBUTE_NORETURN; +extern void fatal_error (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3) + ATTRIBUTE_NORETURN; /* Pass one of the OPT_W* from options.h as the second parameter. */ extern bool pedwarn (location_t, int, const char *, ...) ATTRIBUTE_GCC_DIAG(3,4); diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c index 642cbe3..f7f8aaa 100644 --- a/gcc/diagnostic.c +++ b/gcc/diagnostic.c @@ -1163,6 +1163,23 @@ fatal_error (const char *gmsgid, ...) gcc_unreachable (); } +/* An error which is severe enough that we make no attempt to + continue. Do not use this for internal consistency checks; that's + internal_error. Use of this function should be rare. */ +void +fatal_error (location_t loc, const char *gmsgid, ...) +{ + diagnostic_info diagnostic; + va_list ap; + + va_start (ap, gmsgid); + diagnostic_set_info (&diagnostic, gmsgid, &ap, loc, DK_FATAL); + report_diagnostic (&diagnostic); + va_end (ap); + + gcc_unreachable (); +} + /* An internal consistency check has failed. We make no attempt to continue. Note that unless there is debugging value to be had from a more specific message, or some other good reason, you should use diff --git a/gcc/gcc.c b/gcc/gcc.c index e013d52..6f144de 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -1702,17 +1702,15 @@ typedef const char *const_char_p; /* For DEF_VEC_P. */ static vec<const_char_p> argbuf; -/* Position in the argbuf vector containing the name of the output file - (the value associated with the "-o" flag). */ - -static int have_o_argbuf_index = 0; - /* Were the options -c, -S or -E passed. */ static int have_c = 0; /* Was the option -o passed. */ static int have_o = 0; +/* Pointer to output file name passed in with -o. */ +static const char *output_file = 0; + /* This is the list of suffixes and codes (%g/%u/%U/%j) and the associated temp file. If the HOST_BIT_BUCKET is used for %j, no entry is made for it here. */ @@ -1762,8 +1760,6 @@ store_arg (const char *arg, int delete_always, int delete_failure) { argbuf.safe_push (arg); - if (strcmp (arg, "-o") == 0) - have_o_argbuf_index = argbuf.length (); if (delete_always || delete_failure) { const char *p; @@ -3713,6 +3709,7 @@ driver_handle_option (struct gcc_options *opts, #if defined(HAVE_TARGET_EXECUTABLE_SUFFIX) || defined(HAVE_TARGET_OBJECT_SUFFIX) arg = convert_filename (arg, ! have_c, 0); #endif + output_file = arg; /* Save the output name in case -save-temps=obj was used. */ save_temps_prefix = xstrdup (arg); /* On some systems, ld cannot handle "-o" without a space. So @@ -4052,6 +4049,14 @@ process_command (unsigned int decoded_options_count, CL_DRIVER, &handlers, global_dc); } + if (output_file && strcmp (output_file, "-")) + { + int i; + for (i = 0; i < n_infiles; i++) + if (canonical_filename_eq (infiles[i].name, output_file)) + fatal_error ("output file %s is the same as input file", output_file); + } + /* If -save-temps=obj and -o name, create the prefix to use for %b. Otherwise just make -save-temps=obj the same as -save-temps=cwd. */ if (save_temps_flag == SAVE_TEMPS_OBJ && save_temps_prefix != NULL) diff --git a/gcc/testsuite/gcc.misc-tests/output.exp b/gcc/testsuite/gcc.misc-tests/output.exp new file mode 100644 index 0000000..aac7607 --- /dev/null +++ b/gcc/testsuite/gcc.misc-tests/output.exp @@ -0,0 +1,66 @@ +# Copyright (C) 2005-2014 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +# Run GCC with the input file also specified as output file. Check that the +# compiler prints an error message and does not overwrite the input file. + +load_lib gcc-defs.exp +load_lib target-supports.exp + +# These tests don't run runtest_file_p consistently if it +# doesn't return the same values, so disable parallelization +# of this *.exp file. The first parallel runtest to reach +# this will run all the tests serially. +if ![gcc_parallel_test_run_p output] { + return +} + +# I'm not sure if this is needed here. It was in options.exp. +gcc_parallel_test_enable 0 + +proc check_gcc_overwrite_input {} { + set filename test-[pid] + set fd [open $filename.c w] + puts $fd "int main (void) \{ return 0; \}" + close $fd + remote_download host $filename.c + set test "input overwrite test" + set compiler cc1 + set gcc_output [gcc_target_compile $filename.c $filename.c executable ""] + + # Is this right, or do I need to use something like remote_upload? + set fd [open $filename.c r] + set file_data [read $fd] + close $fd + remote_file build delete $filename.c + + # check if the contents of the input file has changed + if {!($file_data eq "int main (void) \{ return 0; \}\n")} { + fail "$test (input overwritten)" + return + } + + # check if the error message was printed + if {![regexp -- "same as input" $gcc_output]} { + fail "$test (no error printed)" + return + } + pass $test +} + +check_gcc_overwrite_input + +gcc_parallel_test_enable 1 diff --git a/gcc/toplev.c b/gcc/toplev.c index adfae0b..5ad7a56 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -930,10 +930,17 @@ init_asm_output (const char *name) } if (!strcmp (asm_file_name, "-")) asm_out_file = stdout; - else + else if (!canonical_filename_eq (asm_file_name, name)) asm_out_file = fopen (asm_file_name, "w"); + else + /* Use fatal_error (UNKOWN_LOCATION) instead of just fatal_error to + prevent gcc from printing the first line in the current file. */ + fatal_error (UNKNOWN_LOCATION, + "output file %s is the same as input file", + asm_file_name); if (asm_out_file == 0) - fatal_error ("can%'t open %s for writing: %m", asm_file_name); + fatal_error (UNKNOWN_LOCATION, + "can%'t open %s for writing: %m", asm_file_name); } if (!flag_syntax_only) diff --git a/include/filenames.h b/include/filenames.h index e799a51..470c5e0 100644 --- a/include/filenames.h +++ b/include/filenames.h @@ -90,6 +90,8 @@ extern hashval_t filename_hash (const void *s); extern int filename_eq (const void *s1, const void *s2); +extern int canonical_filename_eq (const char *a, const char *b); + #ifdef __cplusplus } #endif diff --git a/libiberty/filename_cmp.c b/libiberty/filename_cmp.c index 9e16d24..9775cd2 100644 --- a/libiberty/filename_cmp.c +++ b/libiberty/filename_cmp.c @@ -24,8 +24,13 @@ #include <string.h> #endif +#ifdef HAVE_STDLIB_H +#include <stdlib.h> +#endif + #include "filenames.h" #include "safe-ctype.h" +#include "libiberty.h" /* @@ -190,3 +195,27 @@ filename_eq (const void *s1, const void *s2) /* The casts are for -Wc++-compat. */ return filename_cmp ((const char *) s1, (const char *) s2) == 0; } + +/* + +@deftypefn Extension int canonical_filename_eq (const char *@var{a}, const char *@var{b}) + +Return non-zero if file names @var{a} and @var{b} are equivalent. +This function compares the canonical versions of the filenames as returned by +@code{lrealpath()}, so that so that different file names pointing to the same +underlying file are treated as being identical. + +@end deftypefn + +*/ + +int +canonical_filename_eq (const char * a, const char * b) +{ + char * ca = lrealpath(a); + char * cb = lrealpath(b); + int res = filename_eq (ca, cb); + free (ca); + free (cb); + return res; +} diff --git a/libiberty/functions.texi b/libiberty/functions.texi index 387aee0..2a759c4 100644 --- a/libiberty/functions.texi +++ b/libiberty/functions.texi @@ -125,6 +125,16 @@ Uses @code{malloc} to allocate storage for @var{nelem} objects of @end deftypefn +@c filename_cmp.c:201 +@deftypefn Extension int canonical_filename_eq (const char *@var{a}, const char *@var{b}) + +Return non-zero if file names @var{a} and @var{b} are equivalent. +This function compares the canonical versions of the filenames as returned by +@code{lrealpath()}, so that so that different file names pointing to the same +underlying file are treated as being identical. + +@end deftypefn + @c choose-temp.c:45 @deftypefn Extension char* choose_temp_base (void) @@ -286,7 +296,7 @@ value 1). If @var{valu} is zero, zero is returned. @end deftypefn -@c filename_cmp.c:32 +@c filename_cmp.c:37 @deftypefn Extension int filename_cmp (const char *@var{s1}, const char *@var{s2}) Return zero if the two file names @var{s1} and @var{s2} are equivalent. @@ -303,7 +313,7 @@ and backward slashes are equal. @end deftypefn -@c filename_cmp.c:178 +@c filename_cmp.c:183 @deftypefn Extension int filename_eq (const void *@var{s1}, const void *@var{s2}) Return non-zero if file names @var{s1} and @var{s2} are equivalent. @@ -311,7 +321,7 @@ This function is for use with hashtab.c hash tables. @end deftypefn -@c filename_cmp.c:147 +@c filename_cmp.c:152 @deftypefn Extension hashval_t filename_hash (const void *@var{s}) Return the hash value for file name @var{s} that will be compared @@ -320,7 +330,7 @@ This function is for use with hashtab.c hash tables. @end deftypefn -@c filename_cmp.c:89 +@c filename_cmp.c:94 @deftypefn Extension int filename_ncmp (const char *@var{s1}, const char *@var{s2}, size_t @var{n}) Return zero if the two file names @var{s1} and @var{s2} are equivalent