Section anchors have broken profile data on powerpc*-linux; the problems
described here started with this mainline patch:
http://gcc.gnu.org/viewcvs?view=rev&rev=113395
r113395 | dje | 2006-04-30 19:23:13 +0000 (Sun, 30 Apr 2006)
Tests mesa, gap, and perlbmk in SPEC CPU2000 fail when compiled with -O1 and
-fprofile-generate/-fprofile-use, although all source files that contain static
variables have extra space generated after the profile counts. Here's what I
get for file dlist.c in mesa:
.section ".bss"
.align 3
.set .LANCHOR0,. + 0
.type .LPBX1, @object
.size .LPBX1, 8496
.LPBX1:
.zero 8496
.zero 18446744073709551128
.type init_flag.9563, @object
.size init_flag.9563, 4
In this case the assembler complains that ".space repeat count is zero" for the
line with the second .zero, and the -fprofile-use compile fails because of
corrupted profile data. gcov shows bogus numbers in this case, although when
the size of the second .zero is small, tests run correctly and gcov data looks
fine.
I don't have a small test case that fails for -fprofile-use or has bogus gcov
results, but here's one where the second .zero is clearly bogus:
--------------------------------
void
foo (int *p, int n)
{
int i;
for (i = 0; i < n; i++)
p[i] = i;
}
static int tmp [1000];
int
main ()
{
foo (tmp, 1000);
return 0;
}
--------------------------------
Part of the corresponding .s file:
.section ".bss"
.align 3
.set .LANCHOR0,. + 0
.type .LPBX1, @object
.size .LPBX1, 32
.LPBX1:
.zero 32
.zero 7976
.type tmp, @object
.size tmp, 4000
tmp:
.zero 4000
--
Summary: section anchors break -fprofile-generate
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: janis at gcc dot gnu dot org
GCC target triplet: powerpc-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28034