public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/43323]  New: Wrong code with bitfields and type casting.
@ 2010-03-10 15:37 marbacz at gmail dot com
  2010-03-10 15:55 ` [Bug middle-end/43323] [4.4 Regression] " rguenth at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: marbacz at gmail dot com @ 2010-03-10 15:37 UTC (permalink / raw)
  To: gcc-bugs

When compiled with gcc 4.4.[34] The following code prints fe 01, while it
should fe ff. Current svn trunk produces correct results.
No flags needed to reproduce.

extern int printf(const char * __restrict, ...);
int main()
{
        struct { unsigned bar:1; } foo;
        foo.bar = 0x1;
        printf("%02x\n", (unsigned char)(foo.bar * 0xfe));
        printf("%02x\n", (unsigned char)(foo.bar * 0xff));
        return 0;
}

gcc -v:

Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-svn/configure --enable-stage1-languages-c
--enable-languages=c,c++
Thread model: posix
gcc version 4.4.4 20100309 (prerelease) (GCC)


-- 
           Summary: Wrong code with bitfields and type casting.
           Product: gcc
           Version: 4.4.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: marbacz at gmail dot com
 GCC build triplet: x86_64-linux-gnu
  GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu


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


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

* [Bug middle-end/43323] [4.4 Regression] Wrong code with bitfields and type casting.
  2010-03-10 15:37 [Bug middle-end/43323] New: Wrong code with bitfields and type casting marbacz at gmail dot com
@ 2010-03-10 15:55 ` rguenth at gcc dot gnu dot org
  2010-03-10 20:05 ` hjl dot tools at gmail dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-03-10 15:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2010-03-10 15:55 -------
Confirmed.

extern void abort (void);
int main()
{
  struct { unsigned bar:1; } foo;
  foo.bar = 0x1;
  if ((unsigned char)(foo.bar * 0xfe) != 0xfeu)
    abort ();
  if ((unsigned char)(foo.bar * 0xff) != 0xffu)
    abort ();
  return 0;
}


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |wrong-code
      Known to fail|                            |4.4.0 4.4.3
      Known to work|                            |4.3.4 4.5.0
   Last reconfirmed|0000-00-00 00:00:00         |2010-03-10 15:55:16
               date|                            |
            Summary|Wrong code with bitfields   |[4.4 Regression] Wrong code
                   |and type casting.           |with bitfields and type
                   |                            |casting.
   Target Milestone|---                         |4.4.4


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


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

* [Bug middle-end/43323] [4.4 Regression] Wrong code with bitfields and type casting.
  2010-03-10 15:37 [Bug middle-end/43323] New: Wrong code with bitfields and type casting marbacz at gmail dot com
  2010-03-10 15:55 ` [Bug middle-end/43323] [4.4 Regression] " rguenth at gcc dot gnu dot org
@ 2010-03-10 20:05 ` hjl dot tools at gmail dot com
  2010-03-11 15:20 ` mikpe at it dot uu dot se
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-03-10 20:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from hjl dot tools at gmail dot com  2010-03-10 20:05 -------
It is fixed on trunk on revision 148631:

http://gcc.gnu.org/ml/gcc-cvs/2009-06/msg00613.html


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nemet at gcc dot gnu dot org


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


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

* [Bug middle-end/43323] [4.4 Regression] Wrong code with bitfields and type casting.
  2010-03-10 15:37 [Bug middle-end/43323] New: Wrong code with bitfields and type casting marbacz at gmail dot com
  2010-03-10 15:55 ` [Bug middle-end/43323] [4.4 Regression] " rguenth at gcc dot gnu dot org
  2010-03-10 20:05 ` hjl dot tools at gmail dot com
@ 2010-03-11 15:20 ` mikpe at it dot uu dot se
  2010-03-13 11:03 ` mikpe at it dot uu dot se
  2010-04-30  8:58 ` jakub at gcc dot gnu dot org
  4 siblings, 0 replies; 9+ messages in thread
From: mikpe at it dot uu dot se @ 2010-03-11 15:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from mikpe at it dot uu dot se  2010-03-11 15:19 -------
Created an attachment (id=20082)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20082&action=view)
backport of Adam Nemet's STRIP_NOPS patch to gcc-4.4.3

I've backported Adam Nemet's STRIP_NOPS patch in r148631 to gcc-4.4.3 and added
the second PR43323 test case. Bootstrapped and regtested on i686-linux w/o
regressions. Both Adam's original test case and the PR43323 one pass with this
patch but fail without it.

I'll do more testing on other archs (arm, sparc64, powerpc64, amd64) next.


-- 


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


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

* [Bug middle-end/43323] [4.4 Regression] Wrong code with bitfields and type casting.
  2010-03-10 15:37 [Bug middle-end/43323] New: Wrong code with bitfields and type casting marbacz at gmail dot com
                   ` (2 preceding siblings ...)
  2010-03-11 15:20 ` mikpe at it dot uu dot se
@ 2010-03-13 11:03 ` mikpe at it dot uu dot se
  2010-04-30  8:58 ` jakub at gcc dot gnu dot org
  4 siblings, 0 replies; 9+ messages in thread
From: mikpe at it dot uu dot se @ 2010-03-13 11:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from mikpe at it dot uu dot se  2010-03-13 11:03 -------
Patch posted to gcc-patches:
http://gcc.gnu.org/ml/gcc-patches/2010-03/msg00510.html


-- 


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


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

* [Bug middle-end/43323] [4.4 Regression] Wrong code with bitfields and type casting.
  2010-03-10 15:37 [Bug middle-end/43323] New: Wrong code with bitfields and type casting marbacz at gmail dot com
                   ` (3 preceding siblings ...)
  2010-03-13 11:03 ` mikpe at it dot uu dot se
@ 2010-04-30  8:58 ` jakub at gcc dot gnu dot org
  4 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-04-30  8:58 UTC (permalink / raw)
  To: gcc-bugs



-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.4.4                       |4.4.5


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


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

* [Bug middle-end/43323] [4.4 Regression] Wrong code with bitfields and type casting.
       [not found] <bug-43323-4@http.gcc.gnu.org/bugzilla/>
  2010-10-01 11:59 ` jakub at gcc dot gnu.org
  2011-04-16 10:38 ` jakub at gcc dot gnu.org
@ 2012-03-13 16:11 ` jakub at gcc dot gnu.org
  2 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-03-13 16:11 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|4.4.7                       |4.5.0

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-03-13 13:04:07 UTC ---
Fixed in 4.5+, 4.4 is no longer supported.


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

* [Bug middle-end/43323] [4.4 Regression] Wrong code with bitfields and type casting.
       [not found] <bug-43323-4@http.gcc.gnu.org/bugzilla/>
  2010-10-01 11:59 ` jakub at gcc dot gnu.org
@ 2011-04-16 10:38 ` jakub at gcc dot gnu.org
  2012-03-13 16:11 ` jakub at gcc dot gnu.org
  2 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-04-16 10:38 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.4.6                       |4.4.7


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

* [Bug middle-end/43323] [4.4 Regression] Wrong code with bitfields and type casting.
       [not found] <bug-43323-4@http.gcc.gnu.org/bugzilla/>
@ 2010-10-01 11:59 ` jakub at gcc dot gnu.org
  2011-04-16 10:38 ` jakub at gcc dot gnu.org
  2012-03-13 16:11 ` jakub at gcc dot gnu.org
  2 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2010-10-01 11:59 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.4.5                       |4.4.6


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

end of thread, other threads:[~2012-03-13 16:10 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-10 15:37 [Bug middle-end/43323] New: Wrong code with bitfields and type casting marbacz at gmail dot com
2010-03-10 15:55 ` [Bug middle-end/43323] [4.4 Regression] " rguenth at gcc dot gnu dot org
2010-03-10 20:05 ` hjl dot tools at gmail dot com
2010-03-11 15:20 ` mikpe at it dot uu dot se
2010-03-13 11:03 ` mikpe at it dot uu dot se
2010-04-30  8:58 ` jakub at gcc dot gnu dot org
     [not found] <bug-43323-4@http.gcc.gnu.org/bugzilla/>
2010-10-01 11:59 ` jakub at gcc dot gnu.org
2011-04-16 10:38 ` jakub at gcc dot gnu.org
2012-03-13 16:11 ` jakub at gcc dot gnu.org

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).