[m-rev.] for review: work around gcc bug (?)
Peter Wang
novalazy at gmail.com
Tue Jan 22 16:29:19 AEDT 2008
Has anyone else seen this? It's happened now on my laptop and on
neptune, both x86-64 machines with gcc 4.1.2. Strange that it doesn't
happen on the nightly builds. It would be better to work around the
problem in MR_COMPUTED_GOTO but I don't know how.
Branches: main
compiler/purity.m:
Work around a segfault while purity checking invalid/purity/purity.m.
It seems to be due to gcc 4.1.2 on x86-64 miscompiling the computed
goto following the workaround at gcc -O1 and above.
Index: compiler/purity.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/purity.m,v
retrieving revision 1.116
diff -u -r1.116 purity.m
--- compiler/purity.m 30 Dec 2007 08:23:54 -0000 1.116
+++ compiler/purity.m 22 Jan 2008 05:20:27 -0000
@@ -313,7 +313,9 @@
),
WorstPurity = Purity,
perform_pred_purity_checks(!.PredInfo, Purity, DeclPurity,
- PromisedPurity, PurityCheckResult),
+ PromisedPurity, PurityCheckResult0),
+ % XXX works around a problem with gcc 4.1.2 on x86_64 machines
+ PurityCheckResult = workaround_gcc_bug(PurityCheckResult0),
(
PurityCheckResult = inconsistent_promise,
Spec = error_inconsistent_promise(ModuleInfo, !.PredInfo, PredId,
@@ -339,6 +341,11 @@
),
!:Specs = PredSpecs ++ !.Specs.
+:- func workaround_gcc_bug(purity_check_result) = purity_check_result.
+:- pragma no_inline(workaround_gcc_bug/1).
+
+workaround_gcc_bug(X) = X.
+
repuritycheck_proc(ModuleInfo, proc(_PredId, ProcId), !PredInfo) :-
pred_info_get_procedures(!.PredInfo, Procs0),
map.lookup(Procs0, ProcId, ProcInfo0),
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list