Bug 30246 - -ggdb3 does not cause -dD to be passed to cc1 for preprocessing
Summary: -ggdb3 does not cause -dD to be passed to cc1 for preprocessing
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: driver (show other bugs)
Version: 3.4.5
: P3 normal
Target Milestone: 4.3.0
Assignee: Tom Tromey
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-12-18 10:01 UTC by Serge
Modified: 2007-02-03 19:38 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2007-01-20 06:23:33


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Serge 2006-12-18 10:01:48 UTC
Hello,

Objects generated using '-ggdb3' are different if the compilation process is split in 2 steps (preprocessing and then compilation) or not.

The issue can be reproduced for the following 'main.c' code using the commands 'gcc -ggdb3 -c main.c' and 'gcc -ggdb3 -c main.c -E > main.i; gcc
-ggdb3 -c main.i'.

The resulting sizes are respectively 15400 and 3992 bytes. Using
'-ggdb2' the generated objects are the same. I guess some debugging
information is lost when the compilation process is split into two steps but as  anyway the macro information generated using 'ggdb3' is not usable with gcc 3.4.5 I did not investigated.
Does anybody know if this is the expected behavior or if it is a bug?
Does a workaround exist?

Thanks in advance and best regards,
Serge

PS: we use gcc 3.4.5 on a Linux/Suse Linux Enterprise Server 9 but the
behavior is the same on Solaris 10 (same gcc version).

The main.c code:
#include <stdio.h>
int main(int argc, char **argv)
{
 printf("Hello\n");
 return 0;
}
Comment 1 Andrew Pinski 2006-12-18 10:09:12 UTC
What is happening is that -ggdb3 does not enable -dD for the preprocessor.
Comment 2 Serge 2006-12-18 11:16:36 UTC
The workaround is ok for me (but is it the expected behavior?).

Best regards,
Serge
Comment 3 Andrew Pinski 2007-01-07 00:49:47 UTC
Confirmed as of today, this is not a regression, a work around is to do -ggdb -g3.
Comment 4 Tom Tromey 2007-01-20 06:23:33 UTC
I'm testing a patch to add -dD when -ggdb3 is passed.
Comment 5 patchapp@dberlin.org 2007-01-22 02:45:30 UTC
Subject: Bug number PR driver/30246

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2007-01/msg01757.html
Comment 6 Tom Tromey 2007-02-03 19:35:18 UTC
Subject: Bug 30246

Author: tromey
Date: Sat Feb  3 19:35:06 2007
New Revision: 121549

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=121549
Log:
	PR driver/30246
	* gcc.c (cpp_unique_options): Any of -ggdb3, -gstabs3,
	-gcoff3, -gxcoff3, -gvms3 implies -dD.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/gcc.c

Comment 7 Tom Tromey 2007-02-03 19:38:07 UTC
Fix checked in.