[LLVMbugs] [Bug 6490] Negative array dimensions allowed in template instantiations

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Mar 4 10:08:57 PST 2010


Douglas Gregor <dgregor at apple.com> changed:

           What    |Removed                     |Added
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE

--- Comment #2 from Douglas Gregor <dgregor at apple.com> 2010-03-04 12:08:57 CST ---
(In reply to comment #1)
> I don't think this is a bug.
> sizeof returns size_t, which is an unsigned integral type, so sizeof(char)-2
> gives an unsigned result, meaning the bug summary is wrong.
> The displayed result is perfectly reasonable too. size_t(-1) * 4, thanks to
> twos-complement, gives the same bit pattern as size_t(-1 * 4), and since you
> omitted the unsigned modifier on the format to printf, you're printing
> int(size_t(-4)), giving -4.

Right, the argument is unsigned, not negative. There is a bugg here, which is
that we're not diagnosing array overflow, which is here:


*** This bug has been marked as a duplicate of bug 1889 ***

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