diff mbox

[rfa] Fix PCH test failure when -fdebug-types-section is enabled

Message ID CAHACq4oDf6cLtLXOMKd2cr1yg+6VJ1udMWJ2jz5VnMgvrwkM7w@mail.gmail.com
State New
Headers show

Commit Message

Cary Coutant April 18, 2013, 10:05 p.m. UTC
If I turn on -fdebug-types-section, I get a failure in the PCH tests:

FAIL: g++.dg/pch/system-2.C -O2 -g assembly comparison

This appears to be the result of differences in hash table traversal
during debug output (same output, slightly different order), so I'm
thinking it's just luck that it works under the default conditions.
The following patch fixes the problem, simply by forcing
-fno-debug-types-section for all PCH tests, but I see no fundamental
reason why that should be necessary. If anyone has any advice for how
to solve the underlying problem, I'd appreciate it.

-cary


 }

Comments

Richard Biener April 19, 2013, 8:13 a.m. UTC | #1
On Fri, Apr 19, 2013 at 12:05 AM, Cary Coutant <ccoutant@google.com> wrote:
> If I turn on -fdebug-types-section, I get a failure in the PCH tests:
>
> FAIL: g++.dg/pch/system-2.C -O2 -g assembly comparison
>
> This appears to be the result of differences in hash table traversal
> during debug output (same output, slightly different order), so I'm
> thinking it's just luck that it works under the default conditions.
> The following patch fixes the problem, simply by forcing
> -fno-debug-types-section for all PCH tests, but I see no fundamental
> reason why that should be necessary. If anyone has any advice for how
> to solve the underlying problem, I'd appreciate it.

Generated code should not depend on actual values of pointers - which
often happens when you traverse a hashtable hashing pointers.  Is this
what is done here?  Then I suggest to hash on something different or
sort after sth different before outputting.

Richard.

> -cary
>
>
> Index: lib/dg-pch.exp
> ===================================================================
> --- lib/dg-pch.exp      (revision 198068)
> +++ lib/dg-pch.exp      (working copy)
> @@ -139,5 +139,5 @@ proc dg-flags-pch { subdir test otherfla
>  }
>
>  proc dg-pch { subdir test options suffix } {
> -  return [dg-flags-pch $subdir $test "" $options $suffix]
> +  return [dg-flags-pch $subdir $test "-fno-debug-types-section"
> $options $suffix]
>  }
Cary Coutant April 24, 2013, 10:51 p.m. UTC | #2
> Generated code should not depend on actual values of pointers - which
> often happens when you traverse a hashtable hashing pointers.  Is this
> what is done here?  Then I suggest to hash on something different or
> sort after sth different before outputting.

That was it, thanks! We were emitting type stub DIEs via a hash table
traversal where the address of the DIE was being used as the hash.

-cary
diff mbox

Patch

Index: lib/dg-pch.exp
===================================================================
--- lib/dg-pch.exp      (revision 198068)
+++ lib/dg-pch.exp      (working copy)
@@ -139,5 +139,5 @@  proc dg-flags-pch { subdir test otherfla
 }

 proc dg-pch { subdir test options suffix } {
-  return [dg-flags-pch $subdir $test "" $options $suffix]
+  return [dg-flags-pch $subdir $test "-fno-debug-types-section"
$options $suffix]