public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/30274]  New: bool bit-field: wrong increment and decremenet
@ 2006-12-21 13:49 s__nakayama at infoseek dot jp
  2006-12-21 18:13 ` [Bug c++/30274] [4.2/4.3 Regression] " pinskia at gcc dot gnu dot org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: s__nakayama at infoseek dot jp @ 2006-12-21 13:49 UTC (permalink / raw)
  To: gcc-bugs

testcase

#include <stdio.h>

#ifndef __cplusplus
typedef _Bool bool;
#endif

struct S
{
  bool x: 4;
};

int main()
{
  struct S x = {1};
  x.x++;                // x.x: value becomes 2.
  printf("%d\n", x.x);
//  x.x--;                // accept invalid
  return 0;
}

GCC 4.2 result
$g++ a.c -o a; ./a
2

GCC 4.1 result
$g++ a.c -o a; ./a
1


GCC version:4.2.0 20061212
The same bug exists also in C-frontend since 4.0.


-- 
           Summary: bool bit-field: wrong increment and decremenet
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: s__nakayama at infoseek dot jp


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


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

end of thread, other threads:[~2007-03-11  3:10 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-21 13:49 [Bug c++/30274] New: bool bit-field: wrong increment and decremenet s__nakayama at infoseek dot jp
2006-12-21 18:13 ` [Bug c++/30274] [4.2/4.3 Regression] " pinskia at gcc dot gnu dot org
2006-12-22  0:52 ` bangerth at dealii dot org
2006-12-22  8:40 ` s__nakayama at infoseek dot jp
2006-12-22  8:46 ` pinskia at gcc dot gnu dot org
2006-12-22  9:24 ` pinskia at gcc dot gnu dot org
2007-02-19 20:58 ` mmitchel at gcc dot gnu dot org
2007-02-21  2:25 ` s__nakayama at infoseek dot jp
2007-02-26 19:10 ` bangerth at dealii dot org
2007-02-26 20:20 ` mmitchel at gcc dot gnu dot org
2007-03-05  3:29 ` mmitchel at gcc dot gnu dot org
2007-03-10 19:53 ` mmitchel at gcc dot gnu dot org
2007-03-11  3:08 ` mmitchel at gcc dot gnu dot org
2007-03-11  3:10 ` mmitchel at gcc dot gnu dot org
2007-03-11  3:10 ` mmitchel at gcc dot gnu dot 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).