Bug 58767 - assemly output (labels order) depends on the sources location.
Summary: assemly output (labels order) depends on the sources location.
Alias: None
Product: gcc
Classification: Unclassified
Component: debug (show other bugs)
Version: 4.8.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2013-10-17 09:48 UTC by Pawel Sikora
Modified: 2021-12-06 04:57 UTC (History)
0 users

See Also:
Host: x86_64-gnu-linux
Target: x86_64-gnu-linux
Build: x86_64-gnu-linux
Known to work:
Known to fail: 4.8.2, 4.9.1
Last reconfirmed:

testcase (25.30 KB, application/x-gzip)
2013-10-17 09:48 UTC, Pawel Sikora

Note You need to log in before you can comment on or make changes to this bug.
Description Pawel Sikora 2013-10-17 09:48:54 UTC
Created attachment 31025 [details]


on the attached testcase you can see that location
of LASF{10,12,28} in the output assembly varies.
this prevents ccache from reuse objects.

LASF24 content change is not a problem and can be unified
in the other way.

$ ./bug.sh
+ rm -f t1.s t2.s
+ CXXFLAGS='-Wall -gno-record-gcc-switches -g2 -gdwarf-4 --save-temps' 
+ g++ -Wall -gno-record-gcc-switches -g2 -gdwarf-4 --save-temps repo/branch1/t.cpp -S
+ mv t.s t1.s
+ mv t.ii t1.ii
+ g++ -Wall -gno-record-gcc-switches -g2 -gdwarf-4 --save-temps repo/branch2/t.cpp -S
+ mv t.s t2.s
+ mv t.ii t2.ii
+ diff -u t1.s t2.s
--- t1.s        2013-10-17 11:38:03.084369344 +0200
+++ t2.s        2013-10-17 11:38:03.177702172 +0200
@@ -407,6 +407,8 @@
        .string "nothrow_t"
        .string "bool"
+       .string "signed char"
        .string "float"
@@ -423,16 +425,14 @@
        .string "__gnu_debug"
        .string "__gnu_cxx"
-       .string "signed char"
+       .string "repo/branch2/t.cpp"
        .string "long long unsigned int"
        .string "unsigned int"
        .string "_ZN9__gnu_cxx24__numeric_traits_integerIlE5__maxE"
-       .string "long unsigned int"
        .string "short unsigned int"
@@ -445,8 +445,8 @@
        .string "GNU C++ 4.8.1 20130531 (release)"
        .string "__max"
-       .string "nothrow"
+       .string "long unsigned int"
        .string "double"
@@ -457,7 +457,7 @@
        .string "__debug"
        .string "__digits"
-       .string "repo/branch1/t.cpp"
+       .string "nothrow"
        .ident  "GCC: (PLD-Linux) 4.8.1 20130531 (release)"
        .section        .note.GNU-stack,"",@progbits
Comment 1 Andrew Pinski 2021-12-06 04:57:46 UTC
The output of the strings is based on the the traverse of the hashtable. this might mean the output of the strings in the hashtable be outputted at a different location based on the hash of the strings.

In this case it is because "repo/branch2/t.cpp" and "repo/branch1/t.cpp" are going to be different hashes which is causing the difference in the hash table traversal.