[LLVMbugs] [Bug 10034] New: Spurious error

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


http://llvm.org/bugs/show_bug.cgi?id=10034

           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;
 exx(x);

 end:

   for (int i = 0; i < argc; ++i)
   {
     puts(argv[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++ 4.3.10.1 (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 :)

Csaba
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