On AMD64, PPC, PPC64, i386: gcc -O3 -c parse_opts.i parse_opts.i: In function `f': parse_opts.i:11: internal compiler error: in gen_lowpart, at emit-rtl.c:1436 The code is invalid (a bit), but it should not crash. reproduced with mainline from some days ago, 3.3-hammer branch, 3.4 branch too.
Created attachment 6881 [details] parse_opts.i compile with -O3 or -finline-functions
Confirmed, the code is undefined. With the mainline we get a different ICE: pr16876.c: In function `f': pr16876.c:8: internal compiler error: in fold_convert, at fold-const.c:2000 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. But this is because of changes by me and other people. Really this is a regression from 2.95.3 and 3.0.4 but that is because of the use of the RTL inliner with those versions instead of the tree inline.
: Search converges between 2001-11-11-trunk (#45) and 2001-11-18-trunk (#46).
The problem in mainline is that 'tree type' of RECORD_TYPE enters fold_convert() and triggers gcc_unreachable() in line 2003. However Borland C++ exits with error: "Call to function 'g' with no prototype." on line where g(0) is called.
*** Bug 20141 has been marked as a duplicate of this bug. ***
*** Bug 20680 has been marked as a duplicate of this bug. ***
See also my notes <http://gcc.gnu.org/ml/gcc-patches/2004-10/msg00772.html> on what should receive warnings (possibly compiled into aborts), what should receive errors and how c_convert_parm_for_inlining (a) is too late for such diagnostics and (b) fails actually to carry out the conversion or diagnostics in certain cases.
*** Bug 24210 has been marked as a duplicate of this bug. ***
P2 is the right setting for this bug; it's popping up often enough to make it worth fixing. Disabling the inlining in the case that the argument type doesn't match (closely enough) the parameter type seems reasonable to me, even without introducing a subsequent runtime abort. That would be equivalent to the behavior if the function called appeared in a different translation unit.
rth assigned this to himself: http://gcc.gnu.org/ml/gcc-bugs/2005-11/msg02843.html A progress report would be nice ;-)
This issue will not be resolved in GCC 4.1.0; retargeted at GCC 4.1.1.
Will not be fixed in 4.1.1; adjust target milestone to 4.1.2.
Unassigning rth, since he's obviously not actually interested in fixing this.
The failures in 3.4 and later are in fold_const, so the gen_lowpart problem is now avoided by, well, ICEing earlier :)
Created attachment 12130 [details] patch I think this should do the trick.
Subject: Bug 16876 Author: amylaar Date: Fri Aug 25 18:51:57 2006 New Revision: 116424 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116424 Log: gcc: PR tree-optimization/16876 * c-typeck.c (c_convert_parm_for_inlining): Don't take early exit if PARM doesn't match VALUE. testsuite: gcc.dg/noncompile/pr16876.c: New test. Added: trunk/gcc/testsuite/gcc.dg/noncompile/pr16876.c Modified: trunk/gcc/ChangeLog trunk/gcc/c-typeck.c trunk/gcc/testsuite/ChangeLog
A backport of the patch bootstraps & regtests ok on the 4.1 branch, but I'm unsure we want the side-effects of the rejects-valid, because this is valid code according to jsm (only undefined at runtime).
(In reply to comment #17) > A backport of the patch bootstraps & regtests ok on the 4.1 branch. Except it introduces PR 29478.
Subject: Bug 16876 Author: rguenth Date: Sat Jun 23 18:17:57 2007 New Revision: 125974 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=125974 Log: 2007-06-23 Richard Guenther <rguenther@suse.de> PR tree-optimization/16876 PR middle-end/29478 * tree.h (CALL_CANNOT_INLINE_P): New macro to access static_flag for CALL_EXPRs. * tree-inline.c (initialize_inlined_parameters): Do not call lang_hooks.tree_inlining.convert_parm_for_inlining. * cgraphbuild.c (initialize_inline_failed): Set inline failed reason for mismatched types. * gimplify.c (gimplify_call_expr): Verify the call expression arguments match the called function type signature. Otherwise mark the call expression to be not considered for inlining using CALL_CANNOT_INLINE_P flag. * ipa-inline.c (cgraph_mark_inline): Honor CALL_CANNOT_INLINE_P on the edges call expression. (cgraph_decide_inlining_of_small_function): Likewise. (cgraph_decide_inlining): Likewise. * c-objc-common.h (LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING): Remove define. * c-tree.h (c_convert_parm_for_inlining): Remove declaration. * c-typeck.c (c_convert_parm_for_inlining): Remove. * langhooks-def.h (lhd_tree_inlining_convert_parm_for_inlining): Remove declaration. (LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING): Remove define. * langhooks.c (lhd_tree_inlining_convert_parm_for_inlining): Remove. * langhooks.h (struct lang_hooks_for_tree_inlining): Remove convert_parm_for_inlining member. * gcc.dg/pr29254.c: The warning is bogus. * gcc.dg/warn-1.c: Likewise. * gcc.dg/assign-warn-3.c: Likewise. * gcc.dg/noncompile/pr16876.c: The testcase is bogus, remove. Removed: trunk/gcc/testsuite/gcc.dg/noncompile/pr16876.c Modified: trunk/gcc/ChangeLog trunk/gcc/c-objc-common.h trunk/gcc/c-tree.h trunk/gcc/c-typeck.c trunk/gcc/cgraphbuild.c trunk/gcc/gimplify.c trunk/gcc/ipa-inline.c trunk/gcc/langhooks-def.h trunk/gcc/langhooks.c trunk/gcc/langhooks.h trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gcc.dg/assign-warn-3.c trunk/gcc/testsuite/gcc.dg/pr29254.c trunk/gcc/testsuite/gcc.dg/warn-1.c trunk/gcc/tree-inline.c trunk/gcc/tree.h
As the code is deemed valid, we still have a rejects-valid bug on the 4.2 branch.
Change target milestone to 4.2.3, as 4.2.2 has been released.
4.2.3 is being released now, changing milestones of open bugs to 4.2.4.
4.2.4 is being released, changing milestones to 4.2.5.
Closing 4.1 branch.
Closing 4.2 branch. Original bug was fixed for 4.2.0, rejects-valid for 4.3.0.