2024-05-19 13:27 AEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000160mercuryBugpublic2010-09-14 12:26
Reportermaclarty 
Assigned Tozs 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionnot fixable 
Product Version 
Target VersionFixed in Version 
Summary0000160: --optimize-fulljumps generating incorrect code
DescriptionCompile the attached file on x86_64-Linux with -O0 --optimize-fulljumps using 10.04 in grade asm_fast.gc. The resulting executable throws an exception, when it shouldn't.

$ mmc --version
Mercury Compiler, version 10.04, configured for x86_64-unknown-linux-gnu
Copyright (C) 1993-2010 The University of Melbourne
$ mmc -O0 --optimize-fulljumps bug.m
$ ./bug
Uncaught Mercury exception:
Software Error: bug
Stack dump not available in this grade.
$ mmc -O0 bug.m
a

I've also tried with rotd-2010-08-27 on saturn. Same problem.
TagsNo tags attached.
Attached Files
  • ? file icon bug.m (842 bytes) 2010-09-07 16:51
  • ? file icon DIFF.160 (854 bytes) 2010-09-08 14:45

-Relationships
+Relationships

-Notes

~0000282

maclarty (developer)

rotd-2010-01-30 does not appear to have the problem, so the regression seems to have been introduced this year.

~0000284

zs (developer)

This is not a Mercury compiler bug. I checked the C code we generate, and it is correct. The problem is in gcc. The problem goes away if you specify -O0 to gcc;
it also goes way if you specify only --no-tree-loop-im to gcc, with other optimizations being enabled as usual at the default optimization level.

This was with gcc 4.4.1 on taura.

~0000285

zs (developer)

Last edited: 2010-09-08 14:54

The diff between the .s files with gcc and gcc -fno-tree-loop-im is shown in DIFF.160.

~0000288

zs (developer)

The bug is in not in mmc, but in gcc; mmc merely generated code that tickles it. A workaround that makes mmc generate code that does not tickle the gcc bug was committed on 10 sep 2010. Another workaround is to disable the gcc optimization that has the problem with --fno-tree-loop-im.
+Notes

-Issue History
Date Modified Username Field Change
2010-09-07 16:51 maclarty New Issue
2010-09-07 16:51 maclarty File Added: bug.m
2010-09-07 16:55 maclarty Note Added: 0000282
2010-09-07 19:02 maclarty Note Added: 0000283
2010-09-07 19:03 maclarty Note Deleted: 0000283
2010-09-08 10:40 zs Status new => assigned
2010-09-08 10:40 zs Assigned To => zs
2010-09-08 14:41 zs Note Added: 0000284
2010-09-08 14:45 zs File Added: DIFF.160
2010-09-08 14:51 zs Note Added: 0000285
2010-09-08 14:54 zs Note Edited: 0000285
2010-09-14 12:26 zs Note Added: 0000288
2010-09-14 12:26 zs Status assigned => closed
2010-09-14 12:26 zs Resolution open => not fixable
+Issue History