Bug 45673 - -fcompare-debug failure with minor difference in dumps
Summary: -fcompare-debug failure with minor difference in dumps
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: debug (show other bugs)
Version: 4.6.0
: P3 normal
Target Milestone: ---
Assignee: Alexandre Oliva
URL:
Keywords: compare-debug-failure
Depends on:
Blocks:
 
Reported: 2010-09-14 23:39 UTC by Zdenek Sojka
Modified: 2022-01-18 23:30 UTC (History)
2 users (show)

See Also:
Host: x86_64-pc-linux-gnu
Target: x86_64-pc-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed: 2010-09-21 08:02:06


Attachments
testcase, preprocessed ada-lang.c from GDB (licensed under GPLv2) (136.60 KB, text/plain)
2010-09-14 23:43 UTC, Zdenek Sojka
Details
Patch that fixes the problem (864 bytes, patch)
2010-09-21 08:53 UTC, Alexandre Oliva
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Zdenek Sojka 2010-09-14 23:39:59 UTC
Command line:
$ gcc -O3 -fcompare-debug -march=amdfam10 ada-langn.i
or
$ gcc -O2 -fcompare-debug -finline-functions -fipa-cp-clone -fkeep-inline-functions  ada-langn.i
(I am not able to reproduce it with these flags anymore)
or
$ gcc -O1 -fgcse -finline-small-functions -foptimize-sibling-calls -ftree-pre -ftree-switch-conversion -ftree-vrp -fpartial-inlining -finline-functions -fkeep-inline-functions -fcompare-debug ada-langn.i

The difference in dumps is small:
$ diff *gkd
107804c107804
<                 (const_int 32 [0x20])) [ MEM[(struct type *)0B].main_type+0 S8 A64])) ada-langn.i:15638# {*movdi_internal_rex64}
---
>                 (const_int 32 [0x20])) [ 0B->main_type+0 S8 A64])) ada-langn.i:15638# {*movdi_internal_rex64}

"MEM[(struct type *)0B]." <=> "0B->"

Tested revision:
r164287 - fail
r164280 - fail
r164228 - fail
Comment 1 Zdenek Sojka 2010-09-14 23:43:39 UTC
Created attachment 21797 [details]
testcase, preprocessed ada-lang.c from GDB (licensed under GPLv2)

Reducing is very slow, after 4 hours of delta run I got to ~16000 lines. So I am uploading the original testcase.
Comment 2 Richard Biener 2010-09-15 09:49:29 UTC
Another dumping artifact probably.  At some point I'd like to dump all
MEM_REFs as MEM[(...)p + cst] and drop the fancy ways.
Comment 3 Alexandre Oliva 2010-09-21 08:02:06 UTC
Mine
Comment 4 Alexandre Oliva 2010-09-21 08:53:10 UTC
Created attachment 21854 [details]
Patch that fixes the problem

Here's the patch I'm testing.  Turns out it's not enough to take only the second pointer type into account, the first also matters because we'll get different dump output depending on whether they're equal or not.  In this case, we failed to distinguish (void*)0B and (struct type*)0B in the first operands.  Richi, care to pre-approve it in case it passes regstrap?
Comment 5 Alexandre Oliva 2010-10-08 04:41:06 UTC
Author: aoliva
Date: Fri Oct  8 04:40:59 2010
New Revision: 165149

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=165149
Log:
PR debug/45673
PR debug/45604
PR debug/45419
PR debug/45408
* tree-pretty-print.c (dump_generic_node): Explicitly dump the
type of MEM_REFs to INTEGER_CSTs.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/tree-pretty-print.c
Comment 6 Alexandre Oliva 2010-10-08 05:49:56 UTC
Fixed