Mercury Bugs - mercury
View Issue Details
0000101mercuryBugpublic2009-07-23 17:582009-07-28 16:45
Assigned Tojuliensf 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000101: Deep profiling of programs compiled against G12 creates currupt files.
DescriptionWhen running even trivial programs such as "hello world" against the G12 libraries the Mercury runtime cannot correctly write out the proc statics to the file.
Additional Informationpbone@goliath:/home/goliath/pbone/rect_pack$ ./hello
Hello world!
Mercury runtime: MR_write_out_proc_static: seen ps
pbone@goliath:/home/goliath/pbone/rect_pack$ echo $?

The minimal set of G12 libraries required to trigger this problem can be linked against if Mercury.options contains:

include "/home/goliath/pbone/g12/install/G12.options"

This occurs regardless of optimization level.

mmc --grade asm_fast.gc.trseg.profdeep --rebuild hello

Note that G12 requires trailing so this cannot be tested in a non-trailed grade.

TagsNo tags attached.
Attached Files

2009-07-23 22:03   
That is not the minimal set of G12 libraries required to reproduce the
problem. Just linking hello world against the FD/IC backend library

    Mercury runtime: UNWRITTEN nodes: file corrupted

Linking hello world against just the FD/IC backend library and the
G12/FD library produces the original abort, i.e.

    Mercury runtime: MR_write_out_proc_static: seen ps
2009-07-23 22:19   
(Last edited: 2009-07-23 22:27)
The problem here is that the we are writing out the proc statics for
the G12/FD and Zinc runtime libraries twice, i.e. there are two calls to mercury__g12_fd__write_out_proc_statics() etc in the _init.c file.

This is occuring because the command lines used to invoke the compiler
contain duplicate --ml options, e.g.

   --ml g12_fd --ml g12_fd

It isn't entirely obvious because it's all hidden behind several layers of
variables and includes in Mercury.options files. It may be possible to
modify G12's library handling to avoid this, but IMO the Mercury compiler
should also be changed to remove duplicate --ml options.

2009-07-24 09:59   
Ahh, I was removing each of the zinc flags variables until I could remove no more without either causing the error or having link errors.

Your diagnosis makes sense fro the 'seen ps' case. After fixing this we should retest it to determine if this and the UNWRITTEN NODES errors are _both_ fixed.
2009-07-28 16:45   
The compiler now removes duplicates from the list of .init files before invoking mkinit.

Issue History
2009-07-23 17:58pboneNew Issue
2009-07-23 22:03juliensfNote Added: 0000178
2009-07-23 22:19juliensfNote Added: 0000179
2009-07-23 22:20juliensfNote Edited: 0000179
2009-07-23 22:27juliensfNote Edited: 0000179
2009-07-23 22:28juliensfStatusnew => feedback
2009-07-24 09:59pboneNote Added: 0000180
2009-07-28 16:45juliensfNote Added: 0000181
2009-07-28 16:45juliensfStatusfeedback => resolved
2009-07-28 16:45juliensfResolutionopen => fixed
2009-07-28 16:45juliensfAssigned To => juliensf