Re: [PATCH] PR36312
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 -- Markus
Re: [PATCH] PR36312
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 ebotca...@adacore.com wrote: 2014-10-25 Anthony Brandon anthony.bran...@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
Re: [PATCH] PR36312
Sorry, I didn't realize the default didn't build all languages. I will configure with --enable-languages=all from now on. On Thu, Nov 6, 2014 at 1:26 AM, Manuel López-Ibáñez lopeziba...@gmail.com wrote: On 5 November 2014 21:57, Eric Botcazou ebotca...@adacore.com wrote: 2014-10-25 Anthony Brandon anthony.bran...@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: It seems the driver adds as input files all the flags passed to the linker, things such as -lm, -soname and libgnat-5.0.so. Very intuitive, not. At least these fake files are marked with '*', so the following on top of the patch should work: Index: gcc.c === --- gcc.c (revision 217149) +++ gcc.c (working copy) @@ -4051,11 +4051,12 @@ process_command (unsigned int decoded_op if (output_file strcmp (output_file, -)) { int i; for (i = 0; i n_infiles; i++) - if (canonical_filename_eq (infiles[i].name, output_file)) + if (infiles[i].language infiles[i].language[0] != '*' +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. */ Testing now. Cheers, Manuel. -- Anthony
Re: [PATCH] PR36312
On 4 November 2014 23:40, Jeff Law l...@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.bran...@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.bran...@gmail.com PR driver/36312 * filenames.h: Add prototype for canonical_filename_eq. gcc/ChangeLog: 2014-10-25 Anthony Brandon anthony.bran...@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.bran...@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.
Re: [PATCH] PR36312
2014-10-25 Anthony Brandon anthony.bran...@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
Re: [PATCH] PR36312
On 5 November 2014 21:57, Eric Botcazou ebotca...@adacore.com wrote: 2014-10-25 Anthony Brandon anthony.bran...@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.
Re: [PATCH] PR36312
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. -- Eric Botcazou
Re: [PATCH] PR36312
On 5 November 2014 23:39, Eric Botcazou ebotca...@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.
Re: [PATCH] PR36312
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. -- Joseph S. Myers jos...@codesourcery.com
Re: [PATCH] PR36312
On 6 November 2014 00:33, Joseph Myers jos...@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.
Re: [PATCH] PR36312
On 5 November 2014 21:57, Eric Botcazou ebotca...@adacore.com wrote: 2014-10-25 Anthony Brandon anthony.bran...@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: It seems the driver adds as input files all the flags passed to the linker, things such as -lm, -soname and libgnat-5.0.so. Very intuitive, not. At least these fake files are marked with '*', so the following on top of the patch should work: Index: gcc.c === --- gcc.c (revision 217149) +++ gcc.c (working copy) @@ -4051,11 +4051,12 @@ process_command (unsigned int decoded_op if (output_file strcmp (output_file, -)) { int i; for (i = 0; i n_infiles; i++) - if (canonical_filename_eq (infiles[i].name, output_file)) + if (infiles[i].language infiles[i].language[0] != '*' +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. */ Testing now. Cheers, Manuel.
Re: [PATCH] PR36312
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.bran...@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.bran...@gmail.com PR driver/36312 * filenames.h: Add prototype for canonical_filename_eq. gcc/ChangeLog: 2014-10-25 Anthony Brandon anthony.bran...@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.bran...@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
Re: [PATCH] PR36312
Hi, Sorry for the delay. Here are the updated diff and changelog. gcc/testsuite/ChangeLog: 2014-10-25 Anthony Brandon anthony.bran...@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.bran...@gmail.com PR driver/36312 * filenames.h: Add prototype for canonical_filename_eq. gcc/ChangeLog: 2014-10-25 Anthony Brandon anthony.bran...@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.bran...@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. On Sun, Oct 19, 2014 at 11:17 AM, Manuel López-Ibáñez lopeziba...@gmail.com wrote: On 18 October 2014 14:43, Anthony Brandon anthony.bran...@gmail.com wrote: Never mind about functions.texi. I figured out how to do it. Here is the new diff and changelog. libiberty/ChangeLog: 2014-10-18 Anthony Brandon anthony.bran...@gmail.com * filename_cmp.c (filename_eq): No change. Unfortunately mklog is not 100% perfect (actually, it is 'diff -p' which is far from perfect). You need to revise that the ChageLog makes sense (or make mklog smarter). Thus, drop (filename_eq)... Also, the changelogs should say PR driver/36312 (https://gcc.gnu.org/codingconventions.html#ChangeLogs). I think you need to explain the difference between using fatal_error() and fatal_error(UNKNOWN_LOCATION). Yes, I should know because I wrote this part of the patch. But to be honest, I don't remember why I did this change. +This function first normalizes the file names so that different file names +pointing to the same underlying file are treated as being identical. I would suggest: This function compares the canonical versions of the filenames as returned by @code{lrealpath()}, so that ... I cannot approve the patch, but it looks fine to me. If you don't get a reply in a few days, you should ping the relevant maintainers: https://gcc.gnu.org/wiki/Community#ping Great first contribution! What are your plans next? Cheers, Manuel. -- Anthony 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 vecconst_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
Re: [PATCH] PR36312
On 18 October 2014 14:43, Anthony Brandon anthony.bran...@gmail.com wrote: Never mind about functions.texi. I figured out how to do it. Here is the new diff and changelog. libiberty/ChangeLog: 2014-10-18 Anthony Brandon anthony.bran...@gmail.com * filename_cmp.c (filename_eq): No change. Unfortunately mklog is not 100% perfect (actually, it is 'diff -p' which is far from perfect). You need to revise that the ChageLog makes sense (or make mklog smarter). Thus, drop (filename_eq)... Also, the changelogs should say PR driver/36312 (https://gcc.gnu.org/codingconventions.html#ChangeLogs). I think you need to explain the difference between using fatal_error() and fatal_error(UNKNOWN_LOCATION). Yes, I should know because I wrote this part of the patch. But to be honest, I don't remember why I did this change. +This function first normalizes the file names so that different file names +pointing to the same underlying file are treated as being identical. I would suggest: This function compares the canonical versions of the filenames as returned by @code{lrealpath()}, so that ... I cannot approve the patch, but it looks fine to me. If you don't get a reply in a few days, you should ping the relevant maintainers: https://gcc.gnu.org/wiki/Community#ping Great first contribution! What are your plans next? Cheers, Manuel.
Re: [PATCH] PR36312
Never mind about functions.texi. I figured out how to do it. Here is the new diff and changelog. libiberty/ChangeLog: 2014-10-18 Anthony Brandon anthony.bran...@gmail.com * filename_cmp.c (filename_eq): No change. (canonical_filename_eq): New function to check if file names are the same. * functions.texi: Updated with documentation for new function. gcc/ChangeLog: 2014-10-18 Anthony Brandon anthony.bran...@gmail.com * 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. gcc/testsuite/ChangeLog: 2014-10-18 Anthony Brandon anthony.bran...@gmail.com * gcc.misc-tests/output.exp: New test case for identical input and output files. include/ChangeLog: 2014-10-18 Anthony Brandon anthony.bran...@gmail.com * filenames.h: Add prototype for canonical_filename_eq. On Sat, Oct 18, 2014 at 12:48 PM, Anthony Brandon anthony.bran...@gmail.com wrote: Hi, I'm a new contributor and I don't yet have a copyright assignment or commit access. I took the patch from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36312 and made some changes. This patch makes GCC check if any of the input files is the same as the output file specified with -o, and if so give an error message rather than overwrite the input file. I moved the canonical_filename_eq to libiberty as suggested in the bug report, added some comments, and also created a new test case. Testing for the same input and output file names didn't really seem to fit into an existing test, so I made a new file based on options.exp. I'm not sure if there is a better way to do this. There is still at least one thing that needs to be done, but I couldn't get it to work and that is to update libiberty/functions.texi. It says to configure with --enable-maintainer-mode, and run make stamp-functions, but I get a no such target error. I bootstrapped on x86_64-linux and tested. include/ChangeLog: 2014-10-18 Anthony Brandon anthony.bran...@gmail.com * filenames.h: Add prototype for canonical_filename_eq. gcc/ChangeLog: 2014-10-18 Anthony Brandon anthony.bran...@gmail.com * 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. gcc/testsuite/ChangeLog: 2014-10-18 Anthony Brandon anthony.bran...@gmail.com * gcc.misc-tests/output.exp: New test case for identical input and output files. libiberty/ChangeLog: 2014-10-18 Anthony Brandon anthony.bran...@gmail.com * filename_cmp.c (filename_eq): No change. (canonical_filename_eq): New function to check if file names are the same. -- Anthony 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 881da0b..1ef95e8 100644 --- a/gcc/diagnostic.c +++ b/gcc/diagnostic.c @@ -1154,6 +1154,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 71c76f8..c0f997d 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -1702,17 +1702,15 @@ typedef const char *const_char_p; /* For DEF_VEC_P. */ static vecconst_char_p argbuf; -/* Position in the argbuf vector containing
Re: [PATCH] PR36312
On Sat, 18 Oct 2014, Anthony Brandon wrote: I'm a new contributor Welcome! I don't yet have a copyright assignment Did you start the paperwork? * filename_cmp.c (filename_eq): No change. I didn't look at the patch, but that's a confusing ChangeLog entry. Did you change something or not? ;-) -- Marc Glisse
Re: [PATCH] PR36312
I didn't start the paper work yet. I'll get started on it. For the changelog entry, I didn't change anything to that function, but mklog gives an entry for it. I think it's because the new function is added after it and at the end if the file. On Sat, Oct 18, 2014 at 3:15 PM, Marc Glisse marc.gli...@inria.fr wrote: On Sat, 18 Oct 2014, Anthony Brandon wrote: I'm a new contributor Welcome! I don't yet have a copyright assignment Did you start the paperwork? * filename_cmp.c (filename_eq): No change. I didn't look at the patch, but that's a confusing ChangeLog entry. Did you change something or not? ;-) -- Marc Glisse -- Anthony