>Number: 6981 >Category: target >Synopsis: wrong code in 64-bit manipulation on x86 >Confidential: no >Severity: critical >Priority: medium >Responsible: unassigned >State: open >Class: wrong-code >Submitter-Id: net >Arrival-Date: Mon Jun 10 02:56:00 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Mattias EngdegÄrd >Release: gcc version 3.1 >Organization: >Environment: redhat 6.2 host (x86) >Description: gcc 3.1 (x86 target) generates wrong code when the attached file is compiled with -O2. The error is in the bar() function. The attach file also serves as a testcase, returning 0 if the bug is present, 1 otherwise. (What makes the problem severe is that the wrong code is generated silently and the exact circumstances unknown, so we are going back to 3.0.4 meanwhile.) >How-To-Repeat: Compile the attached file with -O2, using plain gcc 3.1 for x86, built from source with a default configuration. >Fix: Use a lower optimisation level than -O2 >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: application/octet-stream; name="sr1.c" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="sr1.c" dHlwZWRlZiB1bnNpZ25lZCBsb25nIGxvbmcgdWludDY0OwoKdWludDY0ICpjcDsKdWludDY0IG07 Cgp2b2lkIGZvbyh2b2lkKQp7Cn0KCnZvaWQgYmFyKHVuc2lnbmVkIHJvcCwgdWludDY0ICpyKQp7 Cgl1bnNpZ25lZCByczEsIHJzMiwgcmQ7CgogdG9wOgoJcnMyID0gKHJvcCA+PiAyMykgJiAweDFm ZjsKCXJzMSA9IChyb3AgPj4gOSkgJiAweDFmZjsKCXJkID0gcm9wICYgMHgxZmY7CgoJKmNwID0g MTsKCW0gPSByW3JzMV0gKyByW3JzMl07CgkqY3AgPSAyOwoJZm9vKCk7CglpZiAoIXJkKQoJCWdv dG8gdG9wOwoJcltyZF0gPSAxOwp9CgppbnQgbWFpbih2b2lkKQp7CglzdGF0aWMgdWludDY0IHJb NjRdOwoJdWludDY0IGNyOwoJY3AgPSAmY3I7CgkKCXJbNF0gPSA0NzsKCXJbOF0gPSAxMTsKCWJh cigoOCA8PCAyMykgfCAoNCA8PCA5KSB8IDE1LCByKTsKCQoJcmV0dXJuIG0gPT0gNDcgKyAxMSA/ IDAgOiAxOwp9Cg==