cc1plus -O2 -fnon-call-exceptions fails with internal compiler error: in expand_assignment, at expr.c:3929 for void run (void) { float stack[1]; float *sp = stack; try { float value2 = ((float) *(--sp)); float value1 = ((float) *(--sp)); *(sp++) = (value1 - value2); } catch (int *ex) { } } which is a testcase for PR 23706 written by Andrew Pinski. It passes on 3.4 and 4.0.
I should mention this really undefined code, I did not mean it to be used for any good example at higher optimization than -O0. Anyways confirmed. This has been failing since at least 20050822.
reduced testcase, also failing with -O2 -fnon-call-exceptions void run (void) { float stack[1]; *(stack - 1) = 0.0; }
The problem is that the array is mapped to a single SFmode register. One could probably replace the assert with a run-time invocation of abort().
(In reply to comment #3) > One could probably replace the assert with a run-time invocation of abort(). Or really __builtin_trap() which is better.
A regression hunt identified this patch from steven: http://gcc.gnu.org/ml/gcc-cvs/2005-06/msg00294.html
Subject: Bug 23714 CVSROOT: /cvs/gcc Module name: gcc Changes by: rth@gcc.gnu.org 2005-10-06 00:02:58 Modified files: gcc : ChangeLog tree-cfg.c tree-flow.h tree-optimize.c Added files: gcc/testsuite/g++.dg/opt: pr23714.C Log message: PR 23714 * tree-cfg.c (mark_array_ref_addressable_1): New. (mark_array_ref_addressable): New. * tree-flow.h (mark_array_ref_addressable): Declare. * tree-optimize.c (execute_cleanup_cfg_post_optimizing): Use it. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.10095&r2=2.10096 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-cfg.c.diff?cvsroot=gcc&r1=2.221&r2=2.222 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-flow.h.diff?cvsroot=gcc&r1=2.136&r2=2.137 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-optimize.c.diff?cvsroot=gcc&r1=2.123&r2=2.124 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/opt/pr23714.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
Fixed.
Steven's complaining about the solution...
... so it's his. Revert the patch and do what you like.
Steven is not the only one who is complaining about it.
I think I have every right to complain after what happened to e.g. the CD-DCE patch, thank you very much. FY.
Oh, and for the record, if you don't care about compile time, fine, but SAY SO and say it in public so people know that even the top gcc hacker doesn't give shit about compile time, and so that I can stop wasting my time trying to find places where the compiler is dog slow.
.
Open to...
... work on a better solution.
Subject: Bug 23714 CVSROOT: /cvs/gcc Module name: gcc Changes by: rth@gcc.gnu.org 2005-10-16 00:07:18 Modified files: gcc : ChangeLog builtins.c expr.c expr.h tree-cfg.c tree-flow.h tree-optimize.c Log message: PR 23714 * builtins.c (expand_builtin_trap): Export. * expr.h (expand_builtin_trap): Declare. * expr.c (expand_assignment): Emit a trap for integral offsets from registers that weren't reduced to bitpos. * tree-cfg.c (mark_array_ref_addressable_1): Remove. (mark_array_ref_addressable): Remove. * tree-flow.h (mark_array_ref_addressable): Remove. * tree-optimize.c (execute_cleanup_cfg_post_optimizing): Don't call it. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.10162&r2=2.10163 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/builtins.c.diff?cvsroot=gcc&r1=1.479&r2=1.480 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/expr.c.diff?cvsroot=gcc&r1=1.818&r2=1.819 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/expr.h.diff?cvsroot=gcc&r1=1.192&r2=1.193 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-cfg.c.diff?cvsroot=gcc&r1=2.223&r2=2.224 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-flow.h.diff?cvsroot=gcc&r1=2.138&r2=2.139 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-optimize.c.diff?cvsroot=gcc&r1=2.124&r2=2.125