[LLVMbugs] [Bug 13881] Clang incorrectly accepts zero-length arrays that are not flexible array members

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Sep 19 16:22:01 PDT 2012


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

Kyle Sluder <kyle at omnigroup.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |

--- Comment #2 from Kyle Sluder <kyle at omnigroup.com> 2012-09-19 18:22:01 CDT ---
Is -pedantic-errors the only way to turn this off? Why are these extensions
enabled by default in the first place? Why does it result in different behavior
when the optimizer is enabled rather than disabled?

In the actual case that tripped me up, I was doing this:

NSDivideRect(self.bounds, &separatorRect, (NSRect[]){}, 1.0f, self.isFlipped ?
NSMaxYEdge : NSMinYEdge);

This worked fine on my machine, since I'm building without optimizations, but
it was crashing for our QA engineers, who get optimized builds.

I really think I should have to opt in to this behavior. It's clearly wrong
code.

And even if I do mean what I say, the compiler _definitely_ shouldn't treat
this expression as a NULL pointer. And it _definitely_ shouldn't only do it at
some optimization levels.

I'm not sure what the protocol is here for petitioning for these changes, so
please don't consider me a jerk for reopening this issue. If there's a better
way to address my concerns (like filing a new bug), I'd be happy to follow it.

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