Mercury Bugs - mercury
View Issue Details
0000019mercuryBugpublic2007-10-16 16:242007-10-16 17:37
Reporterwangp 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusconfirmedResolutionopen 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000019: foreign type mutables don't work in high-level C grades
DescriptionIn hlc grades, a mutable of a foreign type FT in a module M will result in a variable declaration in M.mih that refers to FT before the #inclusion of the header that defines FT.
Additional InformationFor the given modules:

% mmc -m aa -s hlc.gc
Making Mercury/os/aa.o
In file included from Mercury/cs/aa.c:26:
aa.m:17: error: syntax error before '*' token
aa.m:17: warning: type defaults to `int' in declaration of `aa__mutable_variable_my_bb'
aa.m:17: warning: data definition has no type or storage class
aa.m:17: error: conflicting types for 'aa__mutable_variable_my_bb'
aa.m:17: error: previous declaration of 'aa__mutable_variable_my_bb' was here
** Error making `Mercury/os/aa.o'.


The same thing works in asm_fast.gc
TagsNo tags attached.
Attached Files? aa.m (606) 2007-10-16 16:24
https://bugs.mercurylang.org/file_download.php?file_id=11&type=bug
? bb.m (840) 2007-10-16 16:25
https://bugs.mercurylang.org/file_download.php?file_id=12&type=bug

Notes
(0000027)
juliensf   
2007-10-16 16:46   
(Last edited: 2007-12-31 11:53)
The same thing works in asm_fast.gc because in that grade mutables always
have type MR_Word.

I think that we need to ensure that all mutables that are foreign types
in the hl* grades also have type MR_Word, rather than the foreign type.
(Actually, since we don't know the type in question it should be boxed
anyway.) [I reported a related set of bugs with float and non-word sized
foreign type mutables in the hl* grades at the beginning of this year, I
haven't fixed them yet since I was waiting for zs's parse tree restructure.]


Issue History
2007-10-16 16:24wangpNew Issue
2007-10-16 16:24wangpFile Added: aa.m
2007-10-16 16:25wangpFile Added: bb.m
2007-10-16 16:46juliensfNote Added: 0000027
2007-10-16 16:46juliensfStatusnew => confirmed
2007-10-16 17:37juliensfNote Added: 0000028
2007-10-16 17:40juliensfNote Deleted: 0000028
2007-12-31 11:53juliensfNote Edited: 0000027