[LLVMbugs] [Bug 10034] New: Spurious error

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri May 27 07:22:11 PDT 2011


           Summary: Spurious error
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: csaba_22 at yahoo.co.uk
                CC: llvmbugs at cs.uiuc.edu

Created an attachment (id=6660)
 --> (http://llvm.org/bugs/attachment.cgi?id=6660)
The problematic file

clang++ version 3.0 (trunk 132119)
Target: x86_64-unknown-linux-gnu
Thread model: posix

emits an error for the following code:

void puts(const char*);

struct X {};

void exx(X) {}

int main(int argc, char **argv)
 if (argc > 3)
   goto end;

 X x;


   for (int i = 0; i < argc; ++i)

   return 0;

c.cc:10:5: error: goto into protected scope
   goto end;
c.cc:12:5: note: jump bypasses variable initialization
 X x;

No errors from g++ version 4.5.0 20100604 [gcc-4_5-branch revision 160292]

Comeau online:

Comeau C/C++ (Oct  6 2008 11:28:09) for ONLINE_EVALUATION_BETA2
Copyright 1988-2008 Comeau Computing.  All rights reserved.
MODE:strict errors C++ C++0x_extensions

In strict mode, with -tused, Compile succeeded

clang has been outvoted 2:1 :)

P.S. compilation succeeds if the for loop is commented out.

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list