[m-rev.] for review: fix bug #196: binary compatiblity checks in C grade don't work

Julien Fischer jfischer at opturion.com
Mon Jul 25 10:10:00 AEST 2016


On Mon, 25 Jul 2016, Paul Bone wrote:

>> Fix bug #196: binary compatibility checks in C grades do not work.
>>
>> These have been broken since 2011 because GCC and clang (at least) began
>> optimising away the MR_grade variable we emit at the end of each generated .c
>> file.  The fix is to replace the MR_grade variable with an exported function
>> that references MR_GRADE_VAR in each generated .c file.
>>
>> compiler/llds_out_file.m:
>> compiler/mlds_to_c.m:
>> util/mkinit.c:
>>      In each generated .c file, emit an exported function that references
>>      MR_GRADE_VAR.
>
> I just upgraded to ROTD 2016-07-18 and noticed this new warning, it wasn't
> there before:
>
> Mercury/asm_fast.gc.debug.stseg/x86_64-pc-linux-gnu/Mercury/cs/js_write_grammar_init.c:3380:13: warning: no previous prototype for ‘mercury_init_grade_check’ [-Wmissing-prototypes]
>
> I'm using gcc 5.4.0 20160609 on x86_64.  The warning seems to be grade
> independant.  It also benign, things otherwise work as expected.

The problem is simply that mkinit is not emitting a prototype for the
function mercury_init_grade_check.  It's not strictly necessary as
nothing will ever call that function.  I'll modify mkinit to emit the
prototype.

Julien.


More information about the reviews mailing list