This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/28031] New: [4.2 regression] bogus jump to case label crosses initialization error


I'm pretty sure the following error is bogus.  I don't see anything invalid in
this test case and it worked with g++ 4.1.  It also works with gcc 4.2 20060419
but not with the current version.

(sid)1053:tbm@reyes: ~] /usr/lib/gcc-snapshot/bin/g++ -c test.c
test.c: In function 'int main()':
test.c:16: error: jump to case label
test.c:13: error:   crosses initialization of 'terror <anonymous>'
zsh: exit 1     /usr/lib/gcc-snapshot/bin/g++ -c test.c
(sid)1054:tbm@reyes: ~] cat test.c
typedef struct terror_struct
{
    int  code;
    char msg[64];
} terror;

int main(void) {
  terror e;
  e = (terror){0,""};

  switch(1) {
  case 1:
    e = (terror){400,"Bad username"};
    break;

  case 2:
    e = (terror){503,"Turboing, connect later"};
    break;

  }
}


-- 
           Summary: [4.2 regression] bogus jump to case label crosses
                    initialization error
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tbm at cyrius dot com


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]