[LLVMbugs] [Bug 3259] New: sema should diagnose illegal jump into scope of variably modified type

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Mon Dec 22 23:00:52 PST 2008


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

           Summary: sema should diagnose illegal jump into scope of variably
                    modified type
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Semantic Analyzer
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: sharparrow1 at yahoo.com
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=2332)
 --> (http://llvm.org/bugs/attachment.cgi?id=2332)
WIP

Per summary, handle cases like the following:

int a(int x) {if (1) {int a[x]; Y:goto X;} X:goto Y;}

"goto X" is legal, but "goto Y" should print a diagnostic.

Attached patch is loosely based off of some discussions on IRC on scoping...
the general approach we discussed there seems to work reasonably well.

There are a few issues with this patch as-is:

1. Efficiency: currently this unconditionally makes two passes over the AST; we
really don't want to do that unless we need to.  Also, we could avoid the
second pass if we made the data structures a bit more elaborate; not sure if
that's worth doing.

2. Generality: this patch is structured to be reasonably general, but I haven't
attempted to implement other similar cases (@finally, compound expressions,
C++).  This patch doesn't descend into declarations correctly.  Also, if
CodeGen is going to use these maps (see below), C++ needs each local variable
with a non-trivial destructor to be its own scope. Also, as written, the
diagnostics aren't flexible enough: scopes aren't tagged, so we can't know what
kind of scope we're illegally jumping into.

3. Exposing the generated information: per discussion on IRC, we want Sema to
expose some information about scopes to CodeGen so it doesn't have to duplicate
similar logic to figure out where to generate destructors/stackrestores/etc.

That said, andersca suggested I post this so it doesn't get lost.


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