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

login
register
mail settings
Submitter Cary Coutant
Date April 18, 2013, 10:05 p.m.
Message ID <CAHACq4oDf6cLtLXOMKd2cr1yg+6VJ1udMWJ2jz5VnMgvrwkM7w@mail.gmail.com>
Download mbox | patch
Permalink /patch/237751/
State New
Headers show

Comments

Cary Coutant - April 18, 2013, 10:05 p.m.
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


 }
Richard Guenther - April 19, 2013, 8:13 a.m.
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.
> 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

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]