digitalmars.D - Anyone want to run this through dmc?
- bcs (8/8) Jul 12 2011 http://blog.regehr.org/archives/558
- bcs (2/9) Jul 12 2011
- Trass3r (4/4) Jul 12 2011 Doing this on Windows is a nightmare.
- bcs (6/10) Jul 12 2011 That's why I'm wondering about building, DMC/linux.
- bcs (19/19) Jul 12 2011 I broke down and installed wine:
- Trass3r (2/4) Jul 13 2011 Yep, is dmc's backend still updated with improvements made in dmd's
- Don (5/10) Jul 22 2011 Yes. But backend bugs are very rare -- roughly 3 are reported per year,
- Walter Bright (4/21) Jul 22 2011 DMC has its own bugzilla, can you post the csmith bugs there, and put cs...
- Walter Bright (11/30) Jul 22 2011 I think DMC is correct here.
- Don (19/65) Jul 25 2011 From a comment on that page:
- Walter Bright (4/5) Jul 25 2011 Reading further shows that there is some controversy about this. It boil...
http://blog.regehr.org/archives/558 That guy is working on some interesting stuff related to compiler bug finding. It would be nice if we could get the DMx back-end into his set of tested compilers. (BTW: what would it take to get a DMC/linux built given there is a DMD/linux?) I killed off my last windows box a few months bask or I'd do this my self. (Yes, I know this isn't exactly D related.)
Jul 12 2011
== Quote from bcs (bcs example.com)'s articleIt would be nice if we could get the DMx back-end into his set of tested compilers. (BTW: what would it take to get a DMC/linux built given there is a DMD/linux?)Seems he's interested (so the above is a relevant question):Quote from regehr: bcs, I’d be happy to add the Digital Mars compiler if I can do so on Linux. (The MSVC result in this post is from one of my more MS-friendly students.)
Jul 12 2011
Doing this on Windows is a nightmare. After finally getting csmith to run, it produced code that apparently is invalid. (since also gcc reports errors) The included perl script doesn't work at all.
Jul 12 2011
== Quote from Trass3r (un known.com)'s articleDoing this on Windows is a nightmare. After finally getting csmith to run, it produced code thatapparently isinvalid. (since also gcc reports errors) The included perl script doesn't work at all.That's why I'm wondering about building, DMC/linux. Also, my original motivation for posting was in hopes of getting the test case he listed run through DMC, but somehow that got lost in the edits. Anyone?
Jul 12 2011
I broke down and installed wine: bcs doors:~/Downloads/dmc$ cat split.cpp #include <stdio.h> struct S0 { unsigned f1 : 1; }; struct S0 s; int main (void) { int x = -3; int y = x >= (0, s.f1); printf ("%d\n", y); return 0; } bcs doors:~/Downloads/dmc$ wine dm/bin/dmc.exe split.cpp link split,,,user32+kernel32/noi; bcs doors:~/Downloads/dmc$ wine split.exe 1 seems DMC is broke too, but it's debatable if this test case is of value to DMD.
Jul 12 2011
seems DMC is broke too, but it's debatable if this test case is of value to DMD.Yep, is dmc's backend still updated with improvements made in dmd's backend?
Jul 13 2011
Trass3r wrote:Yes. But backend bugs are very rare -- roughly 3 are reported per year, compared to 1000 per year for the front-end. About half of those bugs are caused by D-specific situations which never occur in the C compiler.seems DMC is broke too, but it's debatable if this test case is of value to DMD.Yep, is dmc's backend still updated with improvements made in dmd's backend?
Jul 22 2011
On 7/12/2011 10:11 PM, bcs wrote:#include<stdio.h> struct S0 { unsigned f1 : 1; }; struct S0 s; int main (void) { int x = -3; int y = x>= (0, s.f1); printf ("%d\n", y); return 0; } bcs doors:~/Downloads/dmc$ wine dm/bin/dmc.exe split.cpp link split,,,user32+kernel32/noi; bcs doors:~/Downloads/dmc$ wine split.exe 1 seems DMC is broke too, but it's debatable if this test case is of value to DMD.DMC has its own bugzilla, can you post the csmith bugs there, and put csmith in the subject? That'd be cool! http://bugzilla.digitalmars.com/issues/buglist.cgi?quicksearch=.
Jul 22 2011
On 7/12/2011 10:11 PM, bcs wrote:I broke down and installed wine: bcs doors:~/Downloads/dmc$ cat split.cpp #include<stdio.h> struct S0 { unsigned f1 : 1; }; struct S0 s; int main (void) { int x = -3; int y = x>= (0, s.f1); printf ("%d\n", y); return 0; } bcs doors:~/Downloads/dmc$ wine dm/bin/dmc.exe split.cpp link split,,,user32+kernel32/noi; bcs doors:~/Downloads/dmc$ wine split.exe 1 seems DMC is broke too, but it's debatable if this test case is of value to DMD.I think DMC is correct here. x >= (0, s.f1) is typed as: int >= (int, unsigned) which is: int >= unsigned which does an unsigned compare, 0xFFFFFFFD >= 1 which evaluates to: 1
Jul 22 2011
Walter Bright wrote:On 7/12/2011 10:11 PM, bcs wrote:From a comment on that page: ------ The interpretation turns on how you interpret 6.3.1.1p2: The following may be used in an expression wherever an int or unsigned int may be used: — An object or expression with an integer type whose integer conversion rank is less than or equal to the rank of int and unsigned int. — A bit-field of type _Bool, int, signed int, or unsigned int. If an int can represent all values of the original type, the value is converted to an int; otherwise, it is converted to an unsigned int. These are called the integer promotions. All other types are unchanged by the integer promotions. ------ So the unsigned bit field should be promoted to int. And the simplified case: x >= s.f1 should definitely be a signed comparison. Makes me wonder why signed-ness of bitfields is even allowed.I broke down and installed wine: bcs doors:~/Downloads/dmc$ cat split.cpp #include<stdio.h> struct S0 { unsigned f1 : 1; }; struct S0 s; int main (void) { int x = -3; int y = x>= (0, s.f1); printf ("%d\n", y); return 0; } bcs doors:~/Downloads/dmc$ wine dm/bin/dmc.exe split.cpp link split,,,user32+kernel32/noi; bcs doors:~/Downloads/dmc$ wine split.exe 1 seems DMC is broke too, but it's debatable if this test case is of value to DMD.I think DMC is correct here. x >= (0, s.f1) is typed as: int >= (int, unsigned) which is: int >= unsigned which does an unsigned compare, 0xFFFFFFFD >= 1 which evaluates to: 1
Jul 25 2011
On 7/25/2011 3:49 PM, Don wrote:So the unsigned bit field should be promoted to int.Reading further shows that there is some controversy about this. It boils down to the C spec not being clear. DMC does what other major compilers do, so my inclination is to leave it as is until the C committee decides what to do about it.
Jul 25 2011