public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/41445]  New: Debug information is wrong with and without --save-temps.
@ 2009-09-23  9:12 ramana at gcc dot gnu dot org
  2009-09-23 12:32 ` [Bug preprocessor/41445] " jakub at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: ramana at gcc dot gnu dot org @ 2009-09-23  9:12 UTC (permalink / raw)
  To: gcc-bugs

The line number information is off by 1 with and without --save-temps. I faced
this problem when attempting to bootstrap using distcc and got a number of
comparison failures. 

e200593-lin:ramrad01 675 > arm-none-linux-gnueabi-gcc -S -O2 -g t.c -o t1.s -dA
e200593-lin:ramrad01 676 > arm-none-linux-gnueabi-gcc -S -O2 -g t.c -o t2.s
--save-temps -dA
--- t1.s        2009-09-23 10:06:25.000000000 +0100
+++ t2.s        2009-09-23 10:06:30.000000000 +0100
@@ -74,7 +74,7 @@
        .uleb128 0x9    @ (DIE (0x6d) DW_TAG_member)
        .4byte  .LASF7  @ DW_AT_name: "symtab"
        .byte   0x1     @ DW_AT_decl_file (t.h)
-       .byte   0x9     @ DW_AT_decl_line
+       .byte   0x8     @ DW_AT_decl_line
        .4byte  0x25    @ DW_AT_type
        .byte   0x2     @ DW_AT_data_member_location
        .byte   0x23    @ DW_OP_plus_uconst




Consider the testcase below.

e200593-lin:ramrad01 51 > cat t.c  
#include "t.h"
struct tree_type type_decl;
e200593-lin:ramrad01 > cat t.h
#include "ct.h"
struct tree_type GTY(())
{
  union tree_type_symtab {
    int GTY ((tag ("0"))) address;
    const char * GTY ((tag ("1"))) pointer;
  } GTY ((desc ("debug_hooks == &sdb_debug_hooks ? 1 : debug_hooks ==
&dwarf2_debug_hooks ? 2 : 0"),
          descbits ("2"))) symtab;
};
e200593-lin:ramrad01> cat ct.h
#define GTY(x) 


The line number information for the member symtab is off by 1 . It's something
to do with the difference in line number information for the integrated
preprocessor where the integrated preprocessor seems to think that the line
number for symtab is 8 but the information from the saved pre-processed input 
indicates that the line number is 9.


-- 
           Summary: Debug information is wrong with and without --save-
                    temps.
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ramana at gcc dot gnu dot org
 GCC build triplet: i686-linux-gnu
GCC target triplet: arm-none-linux-gnueabi


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41445


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug preprocessor/41445] Debug information is wrong with and without --save-temps.
  2009-09-23  9:12 [Bug preprocessor/41445] New: Debug information is wrong with and without --save-temps ramana at gcc dot gnu dot org
@ 2009-09-23 12:32 ` jakub at gcc dot gnu dot org
  2009-10-06 13:17 ` jakub at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-09-23 12:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jakub at gcc dot gnu dot org  2009-09-23 12:32 -------
Confirmed.  Can be reproduced even with just:
#define A(a,b)
A(1,
  2) int i;
int j;
Here int i; is on the 3rd line, but -E generates
# 1 "h.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "h.c"

 int i;

int j;

The extra line to adjust lines for the two line function-line macro use is
added only after hitting newline after int i;, not already before those tokens.
 So int j; has correct line locus, but int i; doesn't.  Column numbers clearly
can't be maintained the same between normal and -save-temps compilation, that's
a lost case, but perhaps at least line numbers could be kept.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at gcc dot gnu dot
                   |                            |org
  GCC build triplet|i686-linux-gnu              |
 GCC target triplet|arm-none-linux-gnueabi      |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41445


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug preprocessor/41445] Debug information is wrong with and without --save-temps.
  2009-09-23  9:12 [Bug preprocessor/41445] New: Debug information is wrong with and without --save-temps ramana at gcc dot gnu dot org
  2009-09-23 12:32 ` [Bug preprocessor/41445] " jakub at gcc dot gnu dot org
@ 2009-10-06 13:17 ` jakub at gcc dot gnu dot org
  2009-10-07  7:38 ` jakub at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-10-06 13:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jakub at gcc dot gnu dot org  2009-10-06 13:17 -------
Created an attachment (id=18720)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18720&action=view)
gcc45-pr41445.patch

Multi-line comments also screw up locus
of tokens on the same line as the end of the multi-line comment.

The following patch fixes this.  The advantage is that it doesn't slow down the
common operation (preprocessing and compilation together), but maybe slows down
-E a tiny bit.  If only the function-like macros were a problem, we could just
do this in the avoid_paste case, but for multi-line comments no CPP_PADDING
token is added.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41445


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug preprocessor/41445] Debug information is wrong with and without --save-temps.
  2009-09-23  9:12 [Bug preprocessor/41445] New: Debug information is wrong with and without --save-temps ramana at gcc dot gnu dot org
  2009-09-23 12:32 ` [Bug preprocessor/41445] " jakub at gcc dot gnu dot org
  2009-10-06 13:17 ` jakub at gcc dot gnu dot org
@ 2009-10-07  7:38 ` jakub at gcc dot gnu dot org
  2009-10-07  8:20 ` jakub at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-10-07  7:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jakub at gcc dot gnu dot org  2009-10-07 07:37 -------
Created an attachment (id=18733)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18733&action=view)
gcc45-pr41445.patch

Updated patch that actually passed bootstrap.  Unfortunately it regresses many
gcc.dg/cpp/ tests, e.g. avoidpaste1.c is now preprocessed as:
# 1 "../../gcc/testsuite/gcc.dg/cpp/avoidpaste1.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "../../gcc/testsuite/gcc.dg/cpp/avoidpaste1.c"
# 25 "../../gcc/testsuite/gcc.dg/cpp/avoidpaste1.c"
:: : : : : :^: 1.0e-
# 14 "../../gcc/testsuite/gcc.dg/cpp/avoidpaste1.c"
                        1
# 26 "../../gcc/testsuite/gcc.dg/cpp/avoidpaste1.c"
: : : .. . 0 0 .


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #18720|0                           |1
        is obsolete|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41445


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug preprocessor/41445] Debug information is wrong with and without --save-temps.
  2009-09-23  9:12 [Bug preprocessor/41445] New: Debug information is wrong with and without --save-temps ramana at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2009-10-07  7:38 ` jakub at gcc dot gnu dot org
@ 2009-10-07  8:20 ` jakub at gcc dot gnu dot org
  2009-10-09 19:56 ` jakub at gcc dot gnu dot org
  2010-01-04 11:09 ` ramana at gcc dot gnu dot org
  5 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-10-07  8:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jakub at gcc dot gnu dot org  2009-10-07 08:19 -------
Created an attachment (id=18734)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18734&action=view)
gcc45-pr41445.patch

An updated patch that actually fixes all cpp.exp regressions except 2 matches
in spacing1.c, we probably could either drop those or adjust the expected
output with # lines in between, or add -P, or add -P and add another test
without the two lines dropped and without -P.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #18733|0                           |1
        is obsolete|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41445


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug preprocessor/41445] Debug information is wrong with and without --save-temps.
  2009-09-23  9:12 [Bug preprocessor/41445] New: Debug information is wrong with and without --save-temps ramana at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2009-10-07  8:20 ` jakub at gcc dot gnu dot org
@ 2009-10-09 19:56 ` jakub at gcc dot gnu dot org
  2010-01-04 11:09 ` ramana at gcc dot gnu dot org
  5 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-10-09 19:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jakub at gcc dot gnu dot org  2009-10-09 19:55 -------
Subject: Bug 41445

Author: jakub
Date: Fri Oct  9 19:55:34 2009
New Revision: 152599

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=152599
Log:
        PR preprocessor/41445
        * c-ppoutput.c (do_line_change): New function.
        (cb_line_change): Use it.
        (scan_translation_unit): Call do_line_change if
        avoid_paste or PREV_WHITE and token location is on a different line
        than print.src_line.

        * gcc.dg/cpp/separate-1.c: Adjust.
        * gcc.dg/cpp/spacing1.c: Add -P to dg-options.
        * gcc.dg/debug/dwarf2/pr41445-1.c: New test.
        * gcc.dg/debug/dwarf2/pr41445-2.c: New test.
        * gcc.dg/debug/dwarf2/pr41445-3.c: New test.
        * gcc.dg/debug/dwarf2/pr41445-4.c: New test.
        * gcc.dg/debug/dwarf2/pr41445-5.c: New test.
        * gcc.dg/debug/dwarf2/pr41445-6.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-1.c
    trunk/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-2.c
    trunk/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-3.c
    trunk/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-4.c
    trunk/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-5.c
    trunk/gcc/testsuite/gcc.dg/debug/dwarf2/pr41445-6.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-ppoutput.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/cpp/separate-1.c
    trunk/gcc/testsuite/gcc.dg/cpp/spacing1.c


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41445


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug preprocessor/41445] Debug information is wrong with and without --save-temps.
  2009-09-23  9:12 [Bug preprocessor/41445] New: Debug information is wrong with and without --save-temps ramana at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2009-10-09 19:56 ` jakub at gcc dot gnu dot org
@ 2010-01-04 11:09 ` ramana at gcc dot gnu dot org
  5 siblings, 0 replies; 8+ messages in thread
From: ramana at gcc dot gnu dot org @ 2010-01-04 11:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from ramana at gcc dot gnu dot org  2010-01-04 11:09 -------
Fixed on trunk . This problem doesn't exist on 4.4 branch.


-- 

ramana at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.5.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41445


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug preprocessor/41445] Debug information is wrong with and without --save-temps.
       [not found] <bug-41445-4@http.gcc.gnu.org/bugzilla/>
@ 2011-03-31  9:53 ` jakub at gcc dot gnu.org
  0 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-03-31  9:53 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41445

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dg at cowlark dot com

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-03-31 09:12:03 UTC ---
*** Bug 48383 has been marked as a duplicate of this bug. ***


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-03-31  9:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-23  9:12 [Bug preprocessor/41445] New: Debug information is wrong with and without --save-temps ramana at gcc dot gnu dot org
2009-09-23 12:32 ` [Bug preprocessor/41445] " jakub at gcc dot gnu dot org
2009-10-06 13:17 ` jakub at gcc dot gnu dot org
2009-10-07  7:38 ` jakub at gcc dot gnu dot org
2009-10-07  8:20 ` jakub at gcc dot gnu dot org
2009-10-09 19:56 ` jakub at gcc dot gnu dot org
2010-01-04 11:09 ` ramana at gcc dot gnu dot org
     [not found] <bug-41445-4@http.gcc.gnu.org/bugzilla/>
2011-03-31  9:53 ` jakub at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).