FAIL: gcc (GCC) 4.4.7 20110712 (prerelease) FAIL: gcc (GCC) 4.5.4 20110712 (prerelease) FAIL: gcc (GCC) 4.6.2 20110713 (prerelease) FAIL: gcc (GCC) 4.7.0 20110713 (experimental) gcc -c -o 1.o 1.c -g: debug info produced gcc -c -o 1.o 1.S -g: debug info produced gcc -c -o 1.o -g0 1.c -g: debug info produced gcc -c -o 1.o -g0 1.S -g: debug info not produced - IMO a bug Why .c and .S behave differently wrt -g application rules? Sure for .S there is just the .debug_line relevant.
>Why .c and .S behave differently wrt -g application rules? Because something goes wrong in either the driver or as (which GCC has no control over).
The problem is that the specs don't understand that -g0 is overridden by -g in the driver. In the cc1/cc1plus/fortran1 case, the driver passes -g* directly to those programs but in the as case, it has to do something special: #ifndef ASM_DEBUG_SPEC # if defined(DBX_DEBUGGING_INFO) && defined(DWARF2_DEBUGGING_INFO) \ && defined(HAVE_AS_GDWARF2_DEBUG_FLAG) && defined(HAVE_AS_GSTABS_DEBUG_FLAG) # define ASM_DEBUG_SPEC \ (PREFERRED_DEBUGGING_TYPE == DBX_DEBUG \ ? "%{!g0:%{gdwarf-2*:--gdwarf2}%{!gdwarf-2*:%{g*:--gstabs}}}" ASM_MAP \ : "%{!g0:%{gstabs*:--gstabs}%{!gstabs*:%{g*:--gdwarf2}}}" ASM_MAP) # else # if defined(DBX_DEBUGGING_INFO) && defined(HAVE_AS_GSTABS_DEBUG_FLAG) # define ASM_DEBUG_SPEC "%{g*:%{!g0:--gstabs}}" ASM_MAP # endif # if defined(DWARF2_DEBUGGING_INFO) && defined(HAVE_AS_GDWARF2_DEBUG_FLAG) # define ASM_DEBUG_SPEC "%{g*:%{!g0:--gdwarf2}}" ASM_MAP # endif # endif #endif #ifndef ASM_DEBUG_SPEC # define ASM_DEBUG_SPEC "" #endif
I have forgotten this PR and I have hit it again: PASS: gcc (GCC) 4.2.5 20090330 (prerelease) FAIL: gcc (GCC) 4.4.7 FAIL: gcc (GCC) 7.0.0 20161107 (experimental) PASS: gcc-4.1.2-55.el5.x86_64 FAIL: gcc-6.2.1-2.fc24.x86_64 FAIL: gcc-4.4.7-17.el6.x86_64 FAIL: gcc-4.8.5-4.el7.x86_64 Unaware if it is a 4.3 regression or not, I do not have that version ready here.
Created attachment 40489 [details] gcc7-pr49726.patch Untested fix.
Author: jakub Date: Mon Jan 16 21:33:07 2017 New Revision: 244505 URL: https://gcc.gnu.org/viewcvs?rev=244505&root=gcc&view=rev Log: PR driver/49726 * gcc.c (debug_level_greater_than_spec_func): New function. (static_spec_functions): Add debug-level-gt spec function. (ASM_DEBUG_SPEC, cpp_options): Use %:debug-level-gt(0) instead of !g0. * config/darwin.h (DSYMUTIL_SPEC, ASM_DEBUG_SPEC): Likewise. * config/darwin9.h (DSYMUTIL_SPEC, ASM_DEBUG_SPEC): Likewise. * common.opt (g, gcoff, gdwarf, gdwarf-, ggdb, gno-pubnames, gpubnames, ggnu-pubnames, gno-record-gcc-switches, grecord-gcc-switches, gno-strict-dwarf, gstrict-dwarf, gstabs, gstabs+, gtoggle, gvms, gxcoff, gxcoff+): Add Driver flag. c-family/ * c.opt (gen-decls): Add Driver flag. ada/ * gcc-interface/lang.opt (gant, gnatO, gnat): Add Driver flag. Modified: trunk/gcc/ChangeLog trunk/gcc/ada/ChangeLog trunk/gcc/ada/gcc-interface/lang.opt trunk/gcc/c-family/ChangeLog trunk/gcc/c-family/c.opt trunk/gcc/common.opt trunk/gcc/config/darwin.h trunk/gcc/config/darwin9.h trunk/gcc/gcc.c
Fixed on the trunk.
GCC 5 branch is being closed
GCC 6 branch is being closed, fixed in 7.x.