[Bug 41] New: md5.d compilation error with enable checking
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Mar 12 11:13:07 PST 2006
http://d.puremagic.com/bugzilla/show_bug.cgi?id=41
Summary: md5.d compilation error with enable checking
Product: GDC
Version: 0.17
Platform: Macintosh
OS/Version: Mac OS X
Status: NEW
Keywords: ice-on-valid-code, patch
Severity: normal
Priority: P2
Component: glue layer
AssignedTo: braddr at puremagic.com
ReportedBy: braddr at puremagic.com
reduced test case:
module std.md5;
void foo()
{
byte[] input;
void *b = &input[0];
}
proposed fix from our irc discussion which does resolve the compilation error.
Runtime correctness not verified yet.
--- d-codegen.cc.orig 2006-03-11 20:56:16.000000000 -0600
+++ d-codegen.cc 2006-03-11 21:37:14.000000000 -0600
@@ -269,7 +269,7 @@
// %% TODO: stuffing types ok?
if (target_type->ty == Tpointer) {
result = addressOf( exp );
- TREE_TYPE(result) = target_type->toCtype();
+ result = d_convert_basic(target_type->toCtype(), result);
} else if (target_type->ty == Tarray) {
TypeSArray * a_type = (TypeSArray*) exp_type;
@@ -290,7 +290,7 @@
array_len = array_len * sz_a / sz_b;
}
tree pointer_value = addressOf( exp );
- TREE_TYPE(pointer_value) =
target_type->next->pointerTo()->toCtype();
+ pointer_value =
d_convert_basic(target_type->next->pointerTo()->toCtype(), pointer_value);
// Assumes casting to dynamic array of same type or void
return darrayVal(target_type, array_len, pointer_value);
--- d-glue.cc.orig 2006-03-11 21:37:48.000000000 -0600
+++ d-glue.cc 2006-03-12 13:11:42.000000000 -0600
@@ -1424,7 +1424,7 @@
// %% check for &array[index] -> array + index ?
tree t = irs->addressOf(e1->toElem(irs));
- TREE_TYPE(t) = type->toCtype(); // %% is this ever needed?
+ t = d_convert_basic(type->toCtype(), t);
return t;
}
--
More information about the D.gnu
mailing list