Mercury Bugs - mercury
View Issue Details
0000225mercuryBugpublic2011-11-03 10:202011-11-04 00:33
Assigned To 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000225: Module-level mutable with type "semaphore" causes hlc grade compilation to break.
DescriptionCompile attached program with -H. It will produce the following error:

sema_hlc.m:6:25: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

Compiling under asm_fast does not produce this error.
Additional InformationAlso appears with --java.

Compiler version is 11.07-beta-2011-09-30.
TagsNo tags attached.
Attached Files? sema_hlc.m (153) 2011-11-03 10:20

2011-11-03 11:04   
The underlying problem is bug 0000019.

For now I will work around it for the hlc case. There should be no problem with the Java grades; at least I couldn't reproduce it with 2011-10-23.
2011-11-03 11:18   
I only see the bug in the Java grade when I compile with --parallel also:

$ mmc --java --parallel --rebuild sema_hlc.class
Making Mercury/javas/jmercury/
sema_hlc.m:001: Warning: interface for module `sema_hlc' does not export
sema_hlc.m:001: anything.
Making Mercury/classs/jmercury/sema_hlc.class
Mercury/javas/jmercury/ cannot find symbol
symbol : variable thread__semaphore
location: class jmercury.sema_hlc
        V_1_1 = thread__semaphore.init_1_f_0(V_2_2);
1 error
** Error making `Mercury/classs/jmercury/sema_hlc.class'.
2011-11-03 11:26   
Ok, that'd because there is no 'java.par' grade. You *could* install it, but it would be exactly the same as the 'java' grade.
2011-11-03 11:29   
Ahh gotcha. I never realized that...
2011-11-04 00:33   
I suspect attempting to install and/or use the grade "java.par" may have some "interesting" effects on
the compiler and other tools since they probably don't recognise it as a valid combination of grade

Issue History
2011-11-03 10:20colandermanNew Issue
2011-11-03 10:20colandermanFile Added: sema_hlc.m
2011-11-03 11:04wangpNote Added: 0000375
2011-11-03 11:18colandermanNote Added: 0000376
2011-11-03 11:26wangpNote Added: 0000378
2011-11-03 11:29colandermanNote Added: 0000379
2011-11-04 00:33juliensfNote Added: 0000385