Debian Bug report logs - #651595
gcc-4.6: miscompiles p11-kit 0.9 testsuite on i386

version graph

Package: gcc-4.6; Maintainer for gcc-4.6 is (unknown);

Reported by: Andreas Metzler <ametzler@downhill.at.eu.org>

Date: Sat, 10 Dec 2011 10:51:02 UTC

Severity: normal

Found in version gcc-4.6/4.6.2-6

Done: Andreas Metzler <ametzler@downhill.at.eu.org>

Bug is archived. No further changes may be made.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#651595; Package gcc-4.6. (Sat, 10 Dec 2011 10:51:05 GMT) (full text, mbox, link).


Acknowledgement sent to Andreas Metzler <ametzler@downhill.at.eu.org>:
New Bug report received and forwarded. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. (Sat, 10 Dec 2011 10:51:08 GMT) (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: Andreas Metzler <ametzler@downhill.at.eu.org>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: gcc-4.6: miscompiles p11-kit 0.9 testsuite on i386
Date: Sat, 10 Dec 2011 11:47:38 +0100
Package: gcc-4.6
Version: 4.6.2-6
Severity: normal

Hello,

on all i386 archs (linux, kfreebsd and GNU/hurd) p11-kit 0.9 showed a
testsuite error:

| 1) test__p11_hash_set_get_clear: hash-test.c:183: should be null

All other archs are fine. git bisect found this
http://cgit.freedesktop.org/p11-glue/p11-kit/commit/?id=969bcab592878322e410f4342a61fccc06b9addd
as triggering change. - The change only removes some unused code.

Rebuilding tests/hash-test.o with -O0 fixes the issue. The minimal
change is to set __attribute__((optimize("O0"))) on
CuFailInternal().

Both gcc-4.5 and gcc-snapshot 20111203-1 show the same behavior.

cu andreas




Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#651595; Package gcc-4.6. (Wed, 14 Dec 2011 18:12:06 GMT) (full text, mbox, link).


Acknowledgement sent to Andreas Metzler <ametzler@downhill.at.eu.org>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. (Wed, 14 Dec 2011 18:12:06 GMT) (full text, mbox, link).


Message #10 received at 651595@bugs.debian.org (full text, mbox, reply):

From: Andreas Metzler <ametzler@downhill.at.eu.org>
To: p11-glue@lists.freedesktop.org
Cc: 651595@bugs.debian.org
Subject: Re: ANNOUNCE: p11-kit 0.9
Date: Wed, 14 Dec 2011 19:08:55 +0100
On 2011-12-14 Stef Walter <stefw@collabora.co.uk> wrote:
> On 2011-12-10 11:06, Andreas Metzler wrote:
[...]
>> The minimal change I found was to just build CuFailInternal() without
>> optimization, by setting
 
>> __attribute__((optimize("O0")))
>> static void CuFailInternal(CuTest* tc, const char* file, int line,
>> CuString* string)

> Hmmm, I can see this behavior now. If I slightly rearrange any code it
> goes away, and that's why it may be that the above seemingly unrelated
> change fixes the issue.

> What's happening is that in the test__p11_hash_set_get_clear() gcc is
> reordering function calls. The line _p11_hash_clear() is running after
> the last _p11_hash_get() call, even though it's located before it. I've
> verified this with output to stderr :(

> So I'm a bit stuck, not sure if I should just refactor the tests to get
> around the obviously broken compiler, or should I try and take this
> upstream? Trying to track down where...

> The gcc version that I can replicate the issue on is "Ubuntu/Linaro
> 4.6.1-9ubuntu3".
[...]

Hello,

FWIW I have tried reporting this to the Debian bts
http://bugs.debian.org/651595 (bug report cced)
cu andreas




Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#651595; Package gcc-4.6. (Fri, 23 Dec 2011 11:33:04 GMT) (full text, mbox, link).


Acknowledgement sent to Stef Walter <stefw@collabora.co.uk>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. (Fri, 23 Dec 2011 11:33:10 GMT) (full text, mbox, link).


Message #15 received at 651595@bugs.debian.org (full text, mbox, reply):

From: Stef Walter <stefw@collabora.co.uk>
To: Andreas Metzler <ametzler@downhill.at.eu.org>
Cc: p11-glue@lists.freedesktop.org, 651595@bugs.debian.org
Subject: Re: ANNOUNCE: p11-kit 0.9
Date: Fri, 23 Dec 2011 12:28:04 +0100
I gave up trying to build a custom gcc track this down, but here's my
thinking, and what I did to get around it:

 * The optimization bug seems to be in gcc 4.6.1, and is triggered
   in a corner case.
 * The bug seems to be fixed in 4.6.2.
 * I've rearranged the testing code so the bug is no longer triggered
   on gcc 4.6.1

How does that sound? Acceptable?

Cheers,

Stef


On 12/14/2011 07:08 PM, Andreas Metzler wrote:
> On 2011-12-14 Stef Walter <stefw@collabora.co.uk> wrote:
>> On 2011-12-10 11:06, Andreas Metzler wrote:
> [...]
>>> The minimal change I found was to just build CuFailInternal() without
>>> optimization, by setting
>  
>>> __attribute__((optimize("O0")))
>>> static void CuFailInternal(CuTest* tc, const char* file, int line,
>>> CuString* string)
> 
>> Hmmm, I can see this behavior now. If I slightly rearrange any code it
>> goes away, and that's why it may be that the above seemingly unrelated
>> change fixes the issue.
> 
>> What's happening is that in the test__p11_hash_set_get_clear() gcc is
>> reordering function calls. The line _p11_hash_clear() is running after
>> the last _p11_hash_get() call, even though it's located before it. I've
>> verified this with output to stderr :(
> 
>> So I'm a bit stuck, not sure if I should just refactor the tests to get
>> around the obviously broken compiler, or should I try and take this
>> upstream? Trying to track down where...
> 
>> The gcc version that I can replicate the issue on is "Ubuntu/Linaro
>> 4.6.1-9ubuntu3".
> [...]
> 
> Hello,
> 
> FWIW I have tried reporting this to the Debian bts
> http://bugs.debian.org/651595 (bug report cced)
> cu andreas
> _______________________________________________
> p11-glue mailing list
> p11-glue@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/p11-glue


-- 
--

Collabora: http://www.collabora.com
Personal: http://stef.thewalter.net




Reply sent to Andreas Metzler <ametzler@downhill.at.eu.org>:
You have taken responsibility. (Fri, 06 Jan 2012 08:06:04 GMT) (full text, mbox, link).


Notification sent to Andreas Metzler <ametzler@downhill.at.eu.org>:
Bug acknowledged by developer. (Fri, 06 Jan 2012 08:06:04 GMT) (full text, mbox, link).


Message #20 received at 651595-done@bugs.debian.org (full text, mbox, reply):

From: Andreas Metzler <ametzler@downhill.at.eu.org>
To: 651595-done@bugs.debian.org
Subject: Re: Bug#651595: gcc-4.6: miscompiles p11-kit 0.9 testsuite on i386
Date: Fri, 6 Jan 2012 09:03:31 +0100
On 2011-12-10 Andreas Metzler <ametzler@downhill.at.eu.org> wrote:
[...]
> Hello,

> on all i386 archs (linux, kfreebsd and GNU/hurd) p11-kit 0.9 showed a
> testsuite error:

> | 1) test__p11_hash_set_get_clear: hash-test.c:183: should be null

> All other archs are fine. git bisect found this
> http://cgit.freedesktop.org/p11-glue/p11-kit/commit/?id=969bcab592878322e410f4342a61fccc06b9addd
> as triggering change. - The change only removes some unused code.

> Rebuilding tests/hash-test.o with -O0 fixes the issue. The minimal
> change is to set __attribute__((optimize("O0"))) on
> CuFailInternal().

Hello,

I am closing the bug report. p11-kit 0.10 does not trigger the issue
anymore. I am also not sure whether this was a gcc bug at all, p11-kit
was #including .c files, allowing gcc to do some unexpected
optimizations.

cu andreas
-- 
`What a good friend you are to him, Dr. Maturin. His other friends are
so grateful to you.'
`I sew his ears on from time to time, sure'




Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Sat, 04 Feb 2012 07:39:59 GMT) (full text, mbox, link).


Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Tue Sep 2 15:23:21 2025; Machine Name: berlioz

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU General Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.