FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.

» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian GCC

LinkBack Thread Tools
Old 01-11-2012, 08:56 PM
Michael Cree
Default Bug#655518: gcc-4.6 on Alpha: incorrect code generation when compiling git

Package: gcc-4.6
Version: 4.6.2-11
Severity: important
User: debian-alpha@lists.debian.org
Usertags: alpha
X-Debbugs-CC: debian-alpha@lists.debian.org

git_1: FTBFS because of incorrect code generation by gcc-4.6.
The test suite of git fails with a segmentation violation as revealed by
running it under gdb:

Program terminated with signal 11, Segmentation fault.
#0 0x00000001200a44b4 in git_config_rename_section (
old_name=0x11fa8392d "branch.vier", new_name=0x11fa83939 "branch.zwei")
at config.c:1533
1533 output[0] = ' ';
(gdb) list
1528 * a declaration to put on the
1529 * next line; indent with a
1530 * tab
1531 */
1532 output -= 1;
1533 output[0] = ' ';
1534 }
1535 }
1536 remove = 0;
1537 }
(gdb) print output
$1 = 0x11fa83000 "z = 1
(gdb) print output[0]
$2 = 122 'z'
(gdb) print offset
$3 = 16
(gdb) print i
$4 = <optimized out>

A test higher up in the code ensures at this point that output points
into a char array so it is safe to decrement it and deference as the
code above does. Also the print statements above reveal that output
points to valid characters within a bigger char array as expected,
nevertheless a segmentation violation is encountered when writing to

The generated object code is:

1525 if (strlen(output) > 0) {
0x00000001200a448c <+956>: lda t1,1(a1)
0x00000001200a4490 <+960>: ldq_u t2,0(a1)
0x00000001200a4494 <+964>: extqh t2,t1,t1
0x00000001200a4498 <+968>: sra t1,0x38,t1
0x00000001200a449c <+972>: beq t1,0x1200a4228

1526 /*
1527 * More content means there's
1528 * a declaration to put on the
1529 * next line; indent with a
---Type <return> to continue, or q <return> to quit---
1530 * tab
1531 */
1532 output -= 1;
0x00000001200a44bc <+1004>: lda a1,-1(a1)

1533 output[0] = ' ';
0x00000001200a44a0 <+976>: lda t1,1
0x00000001200a44a4 <+980>: sll t1,0x3d,t1
0x00000001200a44a8 <+984>: addq a1,t1,t0
0x00000001200a44ac <+988>: lda t3,-1(t0)
0x00000001200a44b0 <+992>: lda t1,9
=> 0x00000001200a44b4 <+996>: ldq_u t2,-1(t0)
0x00000001200a44b8 <+1000>: insbl t1,t3,t1
0x00000001200a44c0 <+1008>: mskbl t2,t3,t2
0x00000001200a44c4 <+1012>: or t1,t2,t1
0x00000001200a44c8 <+1016>: stq_u t1,-1(t0)
0x00000001200a44cc <+1020>: br 0x1200a4228

At line 1532 it decrements register a1 and saves back to a1, but does
not use that result when saving ' " to output[0]! Instead it sets the
high bit of a1 (the lda t1,1; sll t1,0x3d,t1; addq a1,t1,t0
instructions) and then uses that as the memory address for storing the
' '. But that is no longer in user memory space!

If I compile with the -mcpu=ev67 compiler option (mainly to allow
compilation with the byte-word extension) then the generated code is:

output -= 1;
output[0] = ' ';
22c: 09 00 3f 20 lda t0,9
* More content means there's
* a declaration to put on the
* next line; indent with a
* tab
output -= 1;
230: ff ff 31 22 lda a1,-1(a1)
output[0] = ' ';
234: ff ff 22 38 stb t0,-1(t1)
238: c6 ff ff c3 br 154 <git_config_rename_section+0x154>

It is now clear that the compiler has lost the connection between the
decrement of output and the following store to output. The decrement to
output leaves the result in register a1, but the store to output uses
register t1!

The code compiles correctly with gcc-4.4 and gcc-4.5 so this is gcc-4.6

I attach the source code with just the function that gets incorrectly
compiled. It still requires an extra header file that is part of the
git source, so can't be compiled directly, sorry. My attempt to reduce
it further into a minimal self contained unit no longer exhibited the
incorrect compilation.

Old 01-25-2012, 05:28 PM
Michael Cree
Default Bug#655518: gcc-4.6 on Alpha: incorrect code generation when compiling git

On 12/01/12 10:56, Michael Cree wrote:
> Package: gcc-4.6
> Version: 4.6.2-11
> git_1: FTBFS because of incorrect code generation by gcc-4.6.

This is now PR 51994.



To UNSUBSCRIBE, email to debian-gcc-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 4F2049E4.30105@orcon.net.nz">http://lists.debian.org/4F2049E4.30105@orcon.net.nz

Thread Tools

All times are GMT. The time now is 09:43 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org