Thread overview
[Issue 11612] Inconsistent error on negative new array size
Apr 19, 2014
Andrej Mitrovic
Apr 19, 2014
Andrej Mitrovic
Jul 07, 2017
Vladimir Panteleev
Sep 18, 2022
RazvanN
Dec 17, 2022
Iain Buclaw
Jun 27
Dlang Bot
Jun 28
Dlang Bot
April 19, 2014
https://issues.dlang.org/show_bug.cgi?id=11612

Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich@gmail.com

--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> ---
The change introducing this seems to date 0.72, it's something ancient:

-----
commit 0ad54c6d37b62631d48d452dfb06bb9a932ceb96
Author: Brad Roberts <braddr@puremagic.com>
Date:   Thu Jul 2 07:08:34 2009 +0000

    dmd 0.72
-----

I think it's fair to change this.

--
April 19, 2014
https://issues.dlang.org/show_bug.cgi?id=11612

--- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> ---
Actually nevermind my last comment. AFAICT an IntegerExp ends up having type->ty equal Tuns32 instead of Tint32. From the callstack it seems IntegerExp is constructed with this from one of these calls:

011ee64c 004dfbd4 image00400000!IntegerExp::IntegerExp+0x54
[C:\dmd-git\dmd2\src\dmd\src\expression.c @ 2592]
011ee708 004c4404 image00400000!Neg+0x1ad
[C:\dmd-git\dmd2\src\dmd\src\constfold.c @ 88]
011ee738 00481c75 image00400000!OptimizeVisitor::visit+0x54
[C:\dmd-git\dmd2\src\dmd\src\optimize.c @ 263]
011ee748 004c217f image00400000!NegExp::accept+0x15
[C:\dmd-git\dmd2\src\dmd\src\expression.h @ 976]
011ee77c 004b4855 image00400000!Expression_optimize+0x41
[C:\dmd-git\dmd2\src\dmd\src\optimize.c @ 1224]
011ee83c 00425e29 image00400000!ImplicitConvTo::visit+0x65
[C:\dmd-git\dmd2\src\dmd\src\cast.c @ 181]
011ee84c 00425c85 image00400000!Visitor::visit+0x15
[C:\dmd-git\dmd2\src\dmd\src\visitor.h @ 541]
011ee85c 00481c75 image00400000!Visitor::visit+0x15
[C:\dmd-git\dmd2\src\dmd\src\visitor.h @ 541]
011ee86c 004aff6b image00400000!NegExp::accept+0x15
[C:\dmd-git\dmd2\src\dmd\src\expression.h @ 976]
011ee894 004b275b image00400000!implicitConvTo+0x39
[C:\dmd-git\dmd2\src\dmd\src\cast.c @ 1222]
011ee8e8 00425e29 image00400000!ImplicitCastTo::visit+0x1f
[C:\dmd-git\dmd2\src\dmd\src\cast.c @ 54]
011ee8f8 00425c85 image00400000!Visitor::visit+0x15
[C:\dmd-git\dmd2\src\dmd\src\visitor.h @ 541]
011ee908 00481c75 image00400000!Visitor::visit+0x15
[C:\dmd-git\dmd2\src\dmd\src\visitor.h @ 541]
011ee918 004aff2b image00400000!NegExp::accept+0x15
[C:\dmd-git\dmd2\src\dmd\src\expression.h @ 976]
011ee94c 00468267 image00400000!implicitCastTo+0x43
[C:\dmd-git\dmd2\src\dmd\src\cast.c @ 145]
011eeb8c 004c8b2b image00400000!NewExp::semantic+0x1378
[C:\dmd-git\dmd2\src\dmd\src\expression.c @ 5122]
011eebc4 0049448a image00400000!ExpInitializer::inferType+0x1c
[C:\dmd-git\dmd2\src\dmd\src\init.c @ 920]
011eef0c 00469e65 image00400000!VarDeclaration::semantic+0x21e
[C:\dmd-git\dmd2\src\dmd\src\declaration.c @ 857]
011eef60 004c973e image00400000!DeclarationExp::semantic+0xa3
[C:\dmd-git\dmd2\src\dmd\src\expression.c @ 5858]

I guess I could just emit an error in NewExp::semantic or something, we'll see..

--
July 07, 2017
https://issues.dlang.org/show_bug.cgi?id=11612

Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid

--- Comment #3 from Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> ---
Marking this as accepts-invalid because, ideally, we want to reject all negative integer literals where they don't belong, before their conversion to size_t.

--
September 18, 2022
https://issues.dlang.org/show_bug.cgi?id=11612

RazvanN <razvan.nitu1305@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |bootcamp
                 CC|                            |razvan.nitu1305@gmail.com

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=11612

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P3

--
June 27
https://issues.dlang.org/show_bug.cgi?id=11612

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> ---
@ntrel created dlang/dmd pull request #15359 "Fix Issue 11612 - Inconsistent error on negative new array size" fixing this issue:

- Fix Issue 11612 - Inconsistent error on negative new array size

https://github.com/dlang/dmd/pull/15359

--
June 28
https://issues.dlang.org/show_bug.cgi?id=11612

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #15359 "Fix Issue 11612 - Inconsistent error on negative new array size" was merged into master:

- b02ed4b9c759fbc1b4fee9a4a0cc7d00095792ce by Nick Treleaven:
  Fix Issue 11612 - Inconsistent error on negative new array size

https://github.com/dlang/dmd/pull/15359

--
February 10
https://issues.dlang.org/show_bug.cgi?id=11612

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://issues.dlang.org/sh
                   |                            |ow_bug.cgi?id=24377

--