www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13460] New: dmd can no longer be built with DEBUG=1 on

https://issues.dlang.org/show_bug.cgi?id=13460

          Issue ID: 13460
           Summary: dmd can no longer be built with DEBUG=1 on
                    Linux/x86_64
           Product: D
           Version: D2
          Hardware: x86
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: hsteoh quickfur.ath.cx

The new root/checkedint.c file causes a lot of compile errors when building
with DEBUG=1:
------
g++ -m64 -c -Wno-deprecated -Wstrict-aliasing -fno-exceptions -fno-rtti
-D__pascal= -DMARS=1 -DTARGET_LINUX=1 -DDM_TARGET_CPU_X86=1  -g -g3 -DDEBUG=1
-DUNITTEST -DDMDV2=1 -Iroot -Itk -Ibackend -MMD -MF e2ir.deps e2ir.c
In file included from root/checkedint.c:30:0:
root/checkedint.c: In function ‘void unittest2()’:
root/checkedint.c:98:35: error: call of overloaded ‘adds(long long int, long
long int, bool&)’ is ambiguous
     assert(adds(2LL, 3LL, overflow) == 5);
                                   ^
root/checkedint.c:98:35: note: candidates are:
root/checkedint.c:56:5: note: int adds(int, int, bool&)
 int adds(int x, int y, bool& overflow)
     ^
root/checkedint.c:85:9: note: int64_t adds(int64_t, int64_t, bool&)
 int64_t adds(int64_t x, int64_t y, bool& overflow)
         ^
In file included from root/checkedint.c:30:0:
root/checkedint.c:102:48: error: call of overloaded ‘adds(long long int, long
long int, bool&)’ is ambiguous
     assert(adds(INT64_MIN + 1LL, -1LL, overflow) == INT64_MIN);
                                                ^
root/checkedint.c:102:48: note: candidates are:
root/checkedint.c:56:5: note: int adds(int, int, bool&)
 int adds(int x, int y, bool& overflow)
     ^
root/checkedint.c:85:9: note: int64_t adds(int64_t, int64_t, bool&)
 int64_t adds(int64_t x, int64_t y, bool& overflow)
         ^
In file included from root/checkedint.c:30:0:
root/checkedint.c:109:35: error: call of overloaded ‘adds(long long int, long
long int, bool&)’ is ambiguous
     assert(adds(0LL, 0LL, overflow) == 0);
                                   ^
root/checkedint.c:109:35: note: candidates are:
root/checkedint.c:56:5: note: int adds(int, int, bool&)
 int adds(int x, int y, bool& overflow)
     ^
root/checkedint.c:85:9: note: int64_t adds(int64_t, int64_t, bool&)
 int64_t adds(int64_t x, int64_t y, bool& overflow)
         ^
In file included from root/checkedint.c:30:0:
root/checkedint.c: In function ‘void unittest4()’:
root/checkedint.c:169:37: error: call of overloaded ‘addu(long long unsigned
int, long long unsigned int, bool&)’ is ambiguous
     assert(addu(2ULL, 3ULL, overflow) == 5);
                                     ^
root/checkedint.c:169:37: note: candidates are:
root/checkedint.c:128:10: note: unsigned int addu(unsigned int, unsigned int,
bool&)
 unsigned addu(unsigned x, unsigned y, bool& overflow)
          ^
root/checkedint.c:157:10: note: uint64_t addu(uint64_t, uint64_t, bool&)
 uint64_t addu(uint64_t x, uint64_t y, bool& overflow)
          ^
In file included from root/checkedint.c:30:0:
root/checkedint.c:173:37: error: call of overloaded ‘addu(long long unsigned
int, long long int, bool&)’ is ambiguous
     assert(addu(0ULL, -1LL, overflow) == UINT64_MAX);
                                     ^
root/checkedint.c:173:37: note: candidates are:
root/checkedint.c:128:10: note: unsigned int addu(unsigned int, unsigned int,
bool&)
 unsigned addu(unsigned x, unsigned y, bool& overflow)
          ^
root/checkedint.c:157:10: note: uint64_t addu(uint64_t, uint64_t, bool&)
 uint64_t addu(uint64_t x, uint64_t y, bool& overflow)
          ^
In file included from root/checkedint.c:30:0:
root/checkedint.c:178:41: error: call of overloaded ‘addu(long long unsigned
int, long long int, bool&)’ is ambiguous
     assert(addu(0ULL + 1, -1LL, overflow) == 0ULL);
                                         ^
root/checkedint.c:178:41: note: candidates are:
root/checkedint.c:128:10: note: unsigned int addu(unsigned int, unsigned int,
bool&)
 unsigned addu(unsigned x, unsigned y, bool& overflow)
          ^
root/checkedint.c:157:10: note: uint64_t addu(uint64_t, uint64_t, bool&)
 uint64_t addu(uint64_t x, uint64_t y, bool& overflow)
          ^
In file included from root/checkedint.c:30:0:
root/checkedint.c:180:37: error: call of overloaded ‘addu(long long unsigned
int, long long unsigned int, bool&)’ is ambiguous
     assert(addu(0ULL, 0ULL, overflow) == 0);
                                     ^
root/checkedint.c:180:37: note: candidates are:
root/checkedint.c:128:10: note: unsigned int addu(unsigned int, unsigned int,
bool&)
 unsigned addu(unsigned x, unsigned y, bool& overflow)
          ^
root/checkedint.c:157:10: note: uint64_t addu(uint64_t, uint64_t, bool&)
 uint64_t addu(uint64_t x, uint64_t y, bool& overflow)
          ^
In file included from root/checkedint.c:30:0:
root/checkedint.c: In function ‘void unittest6()’:
root/checkedint.c:242:36: error: call of overloaded ‘subs(long long int, long
long int, bool&)’ is ambiguous
     assert(subs(2LL, -3LL, overflow) == 5);
                                    ^
root/checkedint.c:242:36: note: candidates are:
root/checkedint.c:199:5: note: int subs(int, int, bool&)
 int subs(int x, int y, bool& overflow)
     ^
root/checkedint.c:228:9: note: int64_t subs(int64_t, int64_t, bool&)
 int64_t subs(int64_t x, int64_t y, bool& overflow)
         ^
In file included from root/checkedint.c:30:0:
root/checkedint.c:244:48: error: call of overloaded ‘subs(long long int, long
long int, bool&)’ is ambiguous
     assert(subs(1LL, -INT64_MAX + 1LL, overflow) == INT64_MAX);
                                                ^
root/checkedint.c:244:48: note: candidates are:
root/checkedint.c:199:5: note: int subs(int, int, bool&)
 int subs(int x, int y, bool& overflow)
     ^
root/checkedint.c:228:9: note: int64_t subs(int64_t, int64_t, bool&)
 int64_t subs(int64_t x, int64_t y, bool& overflow)
         ^
In file included from root/checkedint.c:30:0:
root/checkedint.c:246:47: error: call of overloaded ‘subs(long long int, long
long int, bool&)’ is ambiguous
     assert(subs(INT64_MIN + 1LL, 1LL, overflow) == INT64_MIN);
                                               ^
root/checkedint.c:246:47: note: candidates are:
root/checkedint.c:199:5: note: int subs(int, int, bool&)
 int subs(int x, int y, bool& overflow)
     ^
root/checkedint.c:228:9: note: int64_t subs(int64_t, int64_t, bool&)
 int64_t subs(int64_t x, int64_t y, bool& overflow)
         ^
In file included from root/checkedint.c:30:0:
root/checkedint.c:253:35: error: call of overloaded ‘subs(long long int, long
long int, bool&)’ is ambiguous
     assert(subs(0LL, 0LL, overflow) == 0);
                                   ^
root/checkedint.c:253:35: note: candidates are:
root/checkedint.c:199:5: note: int subs(int, int, bool&)
 int subs(int x, int y, bool& overflow)
     ^
root/checkedint.c:228:9: note: int64_t subs(int64_t, int64_t, bool&)
 int64_t subs(int64_t x, int64_t y, bool& overflow)
         ^
In file included from root/checkedint.c:30:0:
root/checkedint.c: In function ‘void unittest8()’:
root/checkedint.c:311:37: error: call of overloaded ‘subu(long long unsigned
int, long long unsigned int, bool&)’ is ambiguous
     assert(subu(3ULL, 2ULL, overflow) == 1);
                                     ^
root/checkedint.c:311:37: note: candidates are:
root/checkedint.c:271:10: note: unsigned int subu(unsigned int, unsigned int,
bool&)
 unsigned subu(unsigned x, unsigned y, bool& overflow)
          ^
root/checkedint.c:300:10: note: uint64_t subu(uint64_t, uint64_t, bool&)
 uint64_t subu(uint64_t x, uint64_t y, bool& overflow)
          ^
In file included from root/checkedint.c:30:0:
root/checkedint.c:315:37: error: call of overloaded ‘subu(long long unsigned
int, long long unsigned int, bool&)’ is ambiguous
     assert(subu(1ULL, 1ULL, overflow) == 0ULL);
                                     ^
root/checkedint.c:315:37: note: candidates are:
root/checkedint.c:271:10: note: unsigned int subu(unsigned int, unsigned int,
bool&)
 unsigned subu(unsigned x, unsigned y, bool& overflow)
          ^
root/checkedint.c:300:10: note: uint64_t subu(uint64_t, uint64_t, bool&)
 uint64_t subu(uint64_t x, uint64_t y, bool& overflow)
          ^
In file included from root/checkedint.c:30:0:
root/checkedint.c:317:37: error: call of overloaded ‘subu(long long unsigned
int, long long unsigned int, bool&)’ is ambiguous
     assert(subu(0ULL, 1ULL, overflow) == UINT64_MAX);
                                     ^
root/checkedint.c:317:37: note: candidates are:
root/checkedint.c:271:10: note: unsigned int subu(unsigned int, unsigned int,
bool&)
 unsigned subu(unsigned x, unsigned y, bool& overflow)
          ^
root/checkedint.c:300:10: note: uint64_t subu(uint64_t, uint64_t, bool&)
 uint64_t subu(uint64_t x, uint64_t y, bool& overflow)
          ^
In file included from root/checkedint.c:30:0:
root/checkedint.c:322:37: error: call of overloaded ‘subu(long long unsigned
int, long long unsigned int, bool&)’ is ambiguous
     assert(subu(0ULL, 0ULL, overflow) == 0);
                                     ^
root/checkedint.c:322:37: note: candidates are:
root/checkedint.c:271:10: note: unsigned int subu(unsigned int, unsigned int,
bool&)
 unsigned subu(unsigned x, unsigned y, bool& overflow)
          ^
root/checkedint.c:300:10: note: uint64_t subu(uint64_t, uint64_t, bool&)
 uint64_t subu(uint64_t x, uint64_t y, bool& overflow)
          ^
In file included from root/checkedint.c:30:0:
root/checkedint.c: In function ‘void unittest10()’:
root/checkedint.c:374:30: error: call of overloaded ‘negs(long long int,
bool&)’ is ambiguous
     assert(negs(0LL, overflow) == -0);
                              ^
root/checkedint.c:374:30: note: candidates are:
root/checkedint.c:338:5: note: int negs(int, bool&)
 int negs(int x, bool& overflow)
     ^
root/checkedint.c:363:9: note: int64_t negs(int64_t, bool&)
 int64_t negs(int64_t x, bool& overflow)
         ^
In file included from root/checkedint.c:30:0:
root/checkedint.c:376:33: error: call of overloaded ‘negs(long long int,
bool&)’ is ambiguous
     assert(negs(1234LL, overflow) == -1234);
                                 ^
root/checkedint.c:376:33: note: candidates are:
root/checkedint.c:338:5: note: int negs(int, bool&)
 int negs(int x, bool& overflow)
     ^
root/checkedint.c:363:9: note: int64_t negs(int64_t, bool&)
 int64_t negs(int64_t x, bool& overflow)
         ^
In file included from root/checkedint.c:30:0:
root/checkedint.c:378:34: error: call of overloaded ‘negs(long long int,
bool&)’ is ambiguous
     assert(negs(-5678LL, overflow) == 5678);
                                  ^
root/checkedint.c:378:34: note: candidates are:
root/checkedint.c:338:5: note: int negs(int, bool&)
 int negs(int x, bool& overflow)
     ^
root/checkedint.c:363:9: note: int64_t negs(int64_t, bool&)
 int64_t negs(int64_t x, bool& overflow)
         ^
In file included from root/checkedint.c:30:0:
root/checkedint.c:382:30: error: call of overloaded ‘negs(long long int,
bool&)’ is ambiguous
     assert(negs(0LL, overflow) == -0);
                              ^
root/checkedint.c:382:30: note: candidates are:
root/checkedint.c:338:5: note: int negs(int, bool&)
 int negs(int x, bool& overflow)
     ^
root/checkedint.c:363:9: note: int64_t negs(int64_t, bool&)
 int64_t negs(int64_t x, bool& overflow)
         ^
In file included from root/checkedint.c:30:0:
root/checkedint.c: In function ‘void unittest11()’:
root/checkedint.c:421:55: warning: integer overflow in expression [-Woverflow]
     assert(muls(INT32_MAX, 2, overflow) == (INT32_MAX * 2));
                                                       ^
root/checkedint.c: In function ‘void unittest12()’:
root/checkedint.c:444:35: error: call of overloaded ‘muls(long long int, long
long int, bool&)’ is ambiguous
     assert(muls(2LL, 3LL, overflow) == 6);
                                   ^
root/checkedint.c:444:35: note: candidates are:
root/checkedint.c:401:5: note: int muls(int, int, bool&)
 int muls(int x, int y, bool& overflow)
     ^
root/checkedint.c:432:9: note: int64_t muls(int64_t, int64_t, bool&)
 int64_t muls(int64_t x, int64_t y, bool& overflow)
         ^
In file included from root/checkedint.c:30:0:
root/checkedint.c:446:40: error: call of overloaded ‘muls(long long int, long
long int, bool&)’ is ambiguous
     assert(muls(-200LL, 300LL, overflow) == -60000);
                                        ^
root/checkedint.c:446:40: note: candidates are:
root/checkedint.c:401:5: note: int muls(int, int, bool&)
 int muls(int x, int y, bool& overflow)
     ^
root/checkedint.c:432:9: note: int64_t muls(int64_t, int64_t, bool&)
 int64_t muls(int64_t x, int64_t y, bool& overflow)
         ^
In file included from root/checkedint.c:30:0:
root/checkedint.c:452:57: warning: integer overflow in expression [-Woverflow]
     assert(muls(INT64_MAX, 2LL, overflow) == (INT64_MAX * 2));
                                                         ^
root/checkedint.c:457:35: error: call of overloaded ‘muls(long long int, long
long int, bool&)’ is ambiguous
     assert(muls(0LL, 0LL, overflow) == 0);
                                   ^
root/checkedint.c:457:35: note: candidates are:
root/checkedint.c:401:5: note: int muls(int, int, bool&)
 int muls(int x, int y, bool& overflow)
     ^
root/checkedint.c:432:9: note: int64_t muls(int64_t, int64_t, bool&)
 int64_t muls(int64_t x, int64_t y, bool& overflow)
         ^
In file included from root/checkedint.c:30:0:
root/checkedint.c: In function ‘void unittest14()’:
root/checkedint.c:518:37: error: call of overloaded ‘mulu(long long unsigned
int, long long unsigned int, bool&)’ is ambiguous
     assert(mulu(2ULL, 3ULL, overflow) == 6);
                                     ^
root/checkedint.c:518:37: note: candidates are:
root/checkedint.c:476:10: note: unsigned int mulu(unsigned int, unsigned int,
bool&)
 unsigned mulu(unsigned x, unsigned y, bool& overflow)
          ^
root/checkedint.c:506:10: note: uint64_t mulu(uint64_t, uint64_t, bool&)
 uint64_t mulu(uint64_t x, uint64_t y, bool& overflow)
          ^
In file included from root/checkedint.c:30:0:
root/checkedint.c:522:34: error: call of overloaded ‘mulu(long long unsigned
int, int, bool&)’ is ambiguous
     assert(mulu(0ULL, 1, overflow) == 0ULL);
                                  ^
root/checkedint.c:522:34: note: candidates are:
root/checkedint.c:476:10: note: unsigned int mulu(unsigned int, unsigned int,
bool&)
 unsigned mulu(unsigned x, unsigned y, bool& overflow)
          ^
root/checkedint.c:506:10: note: uint64_t mulu(uint64_t, uint64_t, bool&)
 uint64_t mulu(uint64_t x, uint64_t y, bool& overflow)
          ^
In file included from root/checkedint.c:30:0:
root/checkedint.c:527:35: error: call of overloaded ‘mulu(long long unsigned
int, int, bool&)’ is ambiguous
     assert(mulu(0ULL, -1, overflow) == 0ULL);
                                   ^
root/checkedint.c:527:35: note: candidates are:
root/checkedint.c:476:10: note: unsigned int mulu(unsigned int, unsigned int,
bool&)
 unsigned mulu(unsigned x, unsigned y, bool& overflow)
          ^
root/checkedint.c:506:10: note: uint64_t mulu(uint64_t, uint64_t, bool&)
 uint64_t mulu(uint64_t x, uint64_t y, bool& overflow)
          ^
In file included from root/checkedint.c:30:0:
root/checkedint.c:530:37: error: call of overloaded ‘mulu(long long unsigned
int, long long unsigned int, bool&)’ is ambiguous
     assert(mulu(0ULL, 0ULL, overflow) == 0);
                                     ^
root/checkedint.c:530:37: note: candidates are:
root/checkedint.c:476:10: note: unsigned int mulu(unsigned int, unsigned int,
bool&)
 unsigned mulu(unsigned x, unsigned y, bool& overflow)
          ^
root/checkedint.c:506:10: note: uint64_t mulu(uint64_t, uint64_t, bool&)
 uint64_t mulu(uint64_t x, uint64_t y, bool& overflow)
          ^
posix.mak:365: recipe for target 'checkedint.o' failed
make[1]: *** [checkedint.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/mnt/1/usr/src/d/dmd/src'
posix.mak:8: recipe for target 'all' failed
make: *** [all] Error 2
------

Looking at the code, this appears to be caused by attempting to declare
overloads between int/long/int64_t, etc., which cause problems with the
different int sizes on different platforms.

Offending pull: https://github.com/D-Programming-Language/dmd/pull/3800

--
Sep 11 2014