public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/49525] New: [4.4] wrong code and wrong warning for bitfield related operations
@ 2011-06-24 22:21 marcin.slusarz at gmail dot com
  2011-06-24 22:21 ` [Bug c++/49525] " marcin.slusarz at gmail dot com
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: marcin.slusarz at gmail dot com @ 2011-06-24 22:21 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49525

           Summary: [4.4] wrong code and wrong warning for bitfield
                    related operations
           Product: gcc
           Version: 4.4.5
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: marcin.slusarz@gmail.com


Created attachment 24595
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24595
testcase

Compilation of attached file generates wrong warning:
$ g++-4.4.5 -c -O2 -Wall all.c
all.c: In function ‘void test(const st_src_reg*, ureg_dst)’:
all.c:118: warning: ‘reg’ is used uninitialized in this function
all.c:118: note: ‘reg’ was declared here

And produces wrong code - at random after "test" function, src[i].Negate (one
bit unsigned bit-field) becomes 1 when src_reg[i]->negate == 0 - something
which should not happen.

The bug does not manifest when compiled with gcc instead of g++ or with g++
4.3.5 or 4.5.2.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/49525] [4.4] wrong code and wrong warning for bitfield related operations
  2011-06-24 22:21 [Bug c++/49525] New: [4.4] wrong code and wrong warning for bitfield related operations marcin.slusarz at gmail dot com
@ 2011-06-24 22:21 ` marcin.slusarz at gmail dot com
  2011-06-24 22:24 ` marcin.slusarz at gmail dot com
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: marcin.slusarz at gmail dot com @ 2011-06-24 22:21 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49525

--- Comment #1 from Marcin Ślusarz <marcin.slusarz at gmail dot com> 2011-06-24 22:20:24 UTC ---
Created attachment 24596
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24596
g++ -v -save-temps -O2 -Wall -c all.c


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/49525] [4.4] wrong code and wrong warning for bitfield related operations
  2011-06-24 22:21 [Bug c++/49525] New: [4.4] wrong code and wrong warning for bitfield related operations marcin.slusarz at gmail dot com
  2011-06-24 22:21 ` [Bug c++/49525] " marcin.slusarz at gmail dot com
@ 2011-06-24 22:24 ` marcin.slusarz at gmail dot com
  2011-06-24 22:38 ` marcin.slusarz at gmail dot com
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: marcin.slusarz at gmail dot com @ 2011-06-24 22:24 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49525

--- Comment #2 from Marcin Ślusarz <marcin.slusarz at gmail dot com> 2011-06-24 22:23:56 UTC ---
Created attachment 24597
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24597
standalone app testing this bug

I'm attaching sources of standalone app which tests this bug.

It should print:
0
0
0
0

Sometimes it prints:
1
1
1
1
a.out: main.c:14: void check_output(ureg_src*): Assertion `sum == 0' failed.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/49525] [4.4] wrong code and wrong warning for bitfield related operations
  2011-06-24 22:21 [Bug c++/49525] New: [4.4] wrong code and wrong warning for bitfield related operations marcin.slusarz at gmail dot com
  2011-06-24 22:21 ` [Bug c++/49525] " marcin.slusarz at gmail dot com
  2011-06-24 22:24 ` marcin.slusarz at gmail dot com
@ 2011-06-24 22:38 ` marcin.slusarz at gmail dot com
  2011-06-24 22:38 ` marcin.slusarz at gmail dot com
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: marcin.slusarz at gmail dot com @ 2011-06-24 22:38 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49525

--- Comment #3 from Marcin Ślusarz <marcin.slusarz at gmail dot com> 2011-06-24 22:37:44 UTC ---
Created attachment 24598
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24598
all.ii


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/49525] [4.4] wrong code and wrong warning for bitfield related operations
  2011-06-24 22:21 [Bug c++/49525] New: [4.4] wrong code and wrong warning for bitfield related operations marcin.slusarz at gmail dot com
                   ` (2 preceding siblings ...)
  2011-06-24 22:38 ` marcin.slusarz at gmail dot com
@ 2011-06-24 22:38 ` marcin.slusarz at gmail dot com
  2011-06-25 12:24 ` mikpe at it dot uu.se
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: marcin.slusarz at gmail dot com @ 2011-06-24 22:38 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49525

--- Comment #4 from Marcin Ślusarz <marcin.slusarz at gmail dot com> 2011-06-24 22:38:06 UTC ---
Created attachment 24599
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24599
all.s


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/49525] [4.4] wrong code and wrong warning for bitfield related operations
  2011-06-24 22:21 [Bug c++/49525] New: [4.4] wrong code and wrong warning for bitfield related operations marcin.slusarz at gmail dot com
                   ` (3 preceding siblings ...)
  2011-06-24 22:38 ` marcin.slusarz at gmail dot com
@ 2011-06-25 12:24 ` mikpe at it dot uu.se
  2011-06-25 12:55 ` mikpe at it dot uu.se
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mikpe at it dot uu.se @ 2011-06-25 12:24 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49525

--- Comment #5 from Mikael Pettersson <mikpe at it dot uu.se> 2011-06-25 12:23:48 UTC ---
I can't reproduce the runtime failure with gcc-4.6-20110621 on x86_64-linux.

I see you're using Gentoo's modified gcc-4.4.5.  Can you please try again with
a g++ built from vanilla unmodified gcc-4.4.5 (or later 4.4.x) sources?


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/49525] [4.4] wrong code and wrong warning for bitfield related operations
  2011-06-24 22:21 [Bug c++/49525] New: [4.4] wrong code and wrong warning for bitfield related operations marcin.slusarz at gmail dot com
                   ` (4 preceding siblings ...)
  2011-06-25 12:24 ` mikpe at it dot uu.se
@ 2011-06-25 12:55 ` mikpe at it dot uu.se
  2011-06-25 15:46 ` bryancain3+gcc at gmail dot com
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mikpe at it dot uu.se @ 2011-06-25 12:55 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49525

Mikael Pettersson <mikpe at it dot uu.se> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikpe at it dot uu.se

--- Comment #6 from Mikael Pettersson <mikpe at it dot uu.se> 2011-06-25 12:54:28 UTC ---
(In reply to comment #5)
> I can't reproduce the runtime failure with gcc-4.6-20110621 on x86_64-linux.

Of course I meant to write gcc-4.4-20110621 not 4.6...


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/49525] [4.4] wrong code and wrong warning for bitfield related operations
  2011-06-24 22:21 [Bug c++/49525] New: [4.4] wrong code and wrong warning for bitfield related operations marcin.slusarz at gmail dot com
                   ` (5 preceding siblings ...)
  2011-06-25 12:55 ` mikpe at it dot uu.se
@ 2011-06-25 15:46 ` bryancain3+gcc at gmail dot com
  2011-06-25 16:41 ` mikpe at it dot uu.se
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: bryancain3+gcc at gmail dot com @ 2011-06-25 15:46 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49525

Bryan Cain <bryancain3+gcc at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bryancain3+gcc at gmail dot
                   |                            |com

--- Comment #7 from Bryan Cain <bryancain3+gcc at gmail dot com> 2011-06-25 15:46:32 UTC ---
I have this problem using the gcc 4.4.5 build in Ubuntu 10.10, which reports
itself as "gcc (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5".  So it's not
Gentoo-specific.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/49525] [4.4] wrong code and wrong warning for bitfield related operations
  2011-06-24 22:21 [Bug c++/49525] New: [4.4] wrong code and wrong warning for bitfield related operations marcin.slusarz at gmail dot com
                   ` (6 preceding siblings ...)
  2011-06-25 15:46 ` bryancain3+gcc at gmail dot com
@ 2011-06-25 16:41 ` mikpe at it dot uu.se
  2011-06-25 18:47 ` marcin.slusarz at gmail dot com
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mikpe at it dot uu.se @ 2011-06-25 16:41 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49525

--- Comment #8 from Mikael Pettersson <mikpe at it dot uu.se> 2011-06-25 16:40:42 UTC ---
(In reply to comment #7)
> I have this problem using the gcc 4.4.5 build in Ubuntu 10.10, which reports
> itself as "gcc (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5".  So it's not
> Gentoo-specific.

That's also a heavily modified vendor compiler.

Please try with an unmodified 4.4.5 or 4.4.6.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/49525] [4.4] wrong code and wrong warning for bitfield related operations
  2011-06-24 22:21 [Bug c++/49525] New: [4.4] wrong code and wrong warning for bitfield related operations marcin.slusarz at gmail dot com
                   ` (7 preceding siblings ...)
  2011-06-25 16:41 ` mikpe at it dot uu.se
@ 2011-06-25 18:47 ` marcin.slusarz at gmail dot com
  2011-06-25 20:23 ` mikpe at it dot uu.se
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: marcin.slusarz at gmail dot com @ 2011-06-25 18:47 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49525

--- Comment #9 from Marcin Ślusarz <marcin.slusarz at gmail dot com> 2011-06-25 18:46:53 UTC ---
Gentoo does not patch gcc severely.

See:
http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-devel/gcc/gcc-4.4.5.ebuild?revision=1.10&view=markup

which adds only 2 patches:
http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-devel/gcc/files/gcc-spec-env.patch?revision=1.6&view=markup
http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-devel/gcc/files/4.4.0/gcc-4.4.0-softfloat.patch?revision=1.1&view=markup
(arm specific)

If that does not convince you, I can compile gcc without these patches. Just
say so.

Please note that runtime failure occurs in ~30-40% runs.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/49525] [4.4] wrong code and wrong warning for bitfield related operations
  2011-06-24 22:21 [Bug c++/49525] New: [4.4] wrong code and wrong warning for bitfield related operations marcin.slusarz at gmail dot com
                   ` (8 preceding siblings ...)
  2011-06-25 18:47 ` marcin.slusarz at gmail dot com
@ 2011-06-25 20:23 ` mikpe at it dot uu.se
  2011-06-26 12:48 ` marcin.slusarz at gmail dot com
  2011-10-09 15:00 ` paolo.carlini at oracle dot com
  11 siblings, 0 replies; 13+ messages in thread
From: mikpe at it dot uu.se @ 2011-06-25 20:23 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49525

Mikael Pettersson <mikpe at it dot uu.se> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|mikpe at it dot uu.se       |

--- Comment #10 from Mikael Pettersson <mikpe at it dot uu.se> 2011-06-25 20:23:26 UTC ---
I don't think that .ebuild file describes everything in detail, specifically I
strongly suspect they also apply 27 patches from gcc-4.4.5-patches-1.2.tar.bz2.

I just recompiled the test case with a freshly built gcc-4.4.5 on x86_64-linux,
and ran it 100 times.  It failed zero times.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/49525] [4.4] wrong code and wrong warning for bitfield related operations
  2011-06-24 22:21 [Bug c++/49525] New: [4.4] wrong code and wrong warning for bitfield related operations marcin.slusarz at gmail dot com
                   ` (9 preceding siblings ...)
  2011-06-25 20:23 ` mikpe at it dot uu.se
@ 2011-06-26 12:48 ` marcin.slusarz at gmail dot com
  2011-10-09 15:00 ` paolo.carlini at oracle dot com
  11 siblings, 0 replies; 13+ messages in thread
From: marcin.slusarz at gmail dot com @ 2011-06-26 12:48 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49525

--- Comment #11 from Marcin Ślusarz <marcin.slusarz at gmail dot com> 2011-06-26 12:48:05 UTC ---
Ok, you are right. I didn't know about these patches.

Now I compiled gcc-4.4.5 with "vanilla" USE flag - which disables all these
patches - and it still fails at runtime.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/49525] [4.4] wrong code and wrong warning for bitfield related operations
  2011-06-24 22:21 [Bug c++/49525] New: [4.4] wrong code and wrong warning for bitfield related operations marcin.slusarz at gmail dot com
                   ` (10 preceding siblings ...)
  2011-06-26 12:48 ` marcin.slusarz at gmail dot com
@ 2011-10-09 15:00 ` paolo.carlini at oracle dot com
  11 siblings, 0 replies; 13+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-10-09 15:00 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49525

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
      Known to work|                            |4.6.0, 4.6.1, 4.7.0
         Resolution|                            |WORKSFORME

--- Comment #12 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-10-09 15:00:06 UTC ---
Can't reproduce with current 4_4-branch, 4_5-branch, 4_6-branch, and mainline.


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2011-10-09 15:00 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-24 22:21 [Bug c++/49525] New: [4.4] wrong code and wrong warning for bitfield related operations marcin.slusarz at gmail dot com
2011-06-24 22:21 ` [Bug c++/49525] " marcin.slusarz at gmail dot com
2011-06-24 22:24 ` marcin.slusarz at gmail dot com
2011-06-24 22:38 ` marcin.slusarz at gmail dot com
2011-06-24 22:38 ` marcin.slusarz at gmail dot com
2011-06-25 12:24 ` mikpe at it dot uu.se
2011-06-25 12:55 ` mikpe at it dot uu.se
2011-06-25 15:46 ` bryancain3+gcc at gmail dot com
2011-06-25 16:41 ` mikpe at it dot uu.se
2011-06-25 18:47 ` marcin.slusarz at gmail dot com
2011-06-25 20:23 ` mikpe at it dot uu.se
2011-06-26 12:48 ` marcin.slusarz at gmail dot com
2011-10-09 15:00 ` paolo.carlini at oracle dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).