http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53688
--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-06-18
13:50:28 UTC ---
NEW_PAGE seems to be miscompiled - we fail to output JOB_ID_RECORD%VERSION
('SPEC CPU'), the comparison difference is lots of
@@ -146,7 +146,7 @@
43255/3 1.1579E+03 -8.1233E+02 0.0000E+00 2.5290E+02
0.0000E+00 0.0000E+00 1 41 1.42E+02 43255
43255/4 -3.5068E+03 -4.3304E+03 0.0000E+00 2.0702E+04
0.0000E+00 0.0000E+00 1 41 1.42E+02 43255
43255/5 -3.5204E+03 -3.2181E+03 0.0000E+00 2.4813E+04
0.0000E+00 0.0000E+00 1 41 1.42E+02 43255
-1 FMA-3D SPEC CPU Impulse Loaded Cylindrical Panel (w/ Subcycling) -
100MB Data Set Page No: 10
+1 FMA-3D Impulse Loaded Cylindrical Panel (w/ Subcycling) -
100MB Data Set Page No: 10
Time T = 4.57200E-07 Time Step = 360
0 NP X-DISPLACE Y-DISPLACE Z-DISPLACE X-VELOCITY Y-VELOCITY
Z-VELOCITY X-ACCELERATE Y-ACCELERATE Z-ACCELERATE NP
by inspecting with gdb you can see that JOB_ID_RECORD%VERSION is properly
populated but HEADLINE is not properly built.
It is sched2 who re-orders
(insn:TI 102 100 250 8 (parallel [
(set (reg:DI 2 cx [143])
(const_int 0 [0]))
(set (reg/f:DI 5 di [141])
(plus:DI (reg/f:DI 5 di [141])
(reg:DI 2 cx [143])))
(set (mem/c:BLK (reg/f:DI 5 di [141]) [0 MEM[(void *)&headline +
9B]+0 A8])
(const_int 0 [0]))
(use (reg:QI 0 ax [142]))
(use (reg:DI 2 cx [143]))
]) t.f90:43848 896 {*rep_stosqi}
(expr_list:REG_UNUSED (reg/f:DI 5 di [141])
(nil)))
and
(insn:TI 106 96 107 8 (set (mem/c:DI (const:DI (plus:DI (symbol_ref:DI
("headline.65670") [flags 0x2] <var_decl 0x7fc398ffbdc0 headline>)
(const_int 10 [0xa]))) [0 MEM[(c_char * {ref-all})&headline
+ 10B]+0 S8 A16])
(reg:DI 1 dx [orig:146 MEM[(c_char * {ref-all})&job_id_record + 12B] ]
[146])) t.f90:43850 62 {*movdi_internal_rex64}
(expr_list:REG_DEAD (reg:DI 1 dx [orig:146 MEM[(c_char *
{ref-all})&job_id_record + 12B] ] [146])
(nil)))
quite possibly because the MEM_ATTRs in the setmem pattern do not have
a MEM_EXPR that has a suitable size.
Testcase:
char headline[256];
struct hdr {
char part1[9];
char part2[8];
} p;
void __attribute__((noinline,noclone))
init()
{
__builtin_memcpy (p.part1, "FOOBARFOO", sizeof (p.part1));
__builtin_memcpy (p.part2, "SPEC CPU", sizeof (p.part2));
}
int main()
{
char *x;
int c;
init();
__builtin_memcpy (&headline[0], p.part1, 9);
c = 9;
x = &headline[0];
x = x + c;
__builtin_memset (x, ' ', 245);
__builtin_memcpy (&headline[10], p.part2, 8);
c = 18;
x = &headline[0];
x = x + c;
__builtin_memset (x, ' ', 238);
if (headline[10] != 'S')
__builtin_abort ();
return 0;
}