[Issue 231] New: long is 4-byte aligned in unittest with 4 character module name
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Jun 29 11:17:56 PDT 2006
http://d.puremagic.com/issues/show_bug.cgi?id=231
Summary: long is 4-byte aligned in unittest with 4 character
module name
Product: D
Version: 0.161
Platform: PC
OS/Version: Windows
Status: NEW
Keywords: wrong-code
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: sean at f4.ca
This one is really weird. It turns out that the value must be used in a
unittest, etc, as per the test case, and the error actually goes away if I
change the module name to be larger than 4 characters. This is a new bug, as
the test this is derived from used to pass without error:
C:\code\src\d\bugs>type 161x.d
template testStoreIf( T )
{
void testStoreIf( T val = T.init + 1 )
{
T base;
assert( atomicValueIsProperlyAligned!(T)( cast(size_t) &base ) );
}
}
import std.c.stdio;
template atomicValueIsProperlyAligned( T )
{
bool atomicValueIsProperlyAligned( size_t addr )
{
printf( "%p %% %u = %u\n", addr, T.sizeof, addr % T.sizeof );
return addr % T.sizeof == 0;
}
}
unittest
{
testStoreIf!(long)();
}
void main()
{
}
C:\code\src\d\bugs>dmd -unittest 161x.d
C:\bin\dmd\bin\..\..\dm\bin\link.exe 161x,,,user32+kernel32/noi;
C:\code\src\d\bugs>161x
0012FEEC % 8 = 4
161x(6): Assertion failure
C:\code\src\d\bugs>copy 161x.d 161_1.d
1 file(s) copied.
C:\code\src\d\bugs>dmd -unittest 161_1.d
C:\bin\dmd\bin\..\..\dm\bin\link.exe 161_1,,,user32+kernel32/noi;
C:\code\src\d\bugs>161_1
0012FEE8 % 8 = 0
C:\code\src\d\bugs>
--
More information about the Digitalmars-d-bugs
mailing list