re PR middle-end/31959 (ICE in expand_builtin_expect, at builtins.c:5112)

PR middle-end/31959
	* builtins.c: Include diagnostic.h.
	(expand_builtin_expect): Make gcc_assert more permissive.
	* Makefile.in (builtins.o): Depend on $(DIAGNOSTIC_H).

	* gcc.dg/pr31959.c: New test.

From-SVN: r125875
This commit is contained in:
Jakub Jelinek 2007-06-20 08:39:53 +02:00 committed by Jakub Jelinek
parent f497c16c26
commit 1d8381f13f
5 changed files with 32 additions and 2 deletions

View File

@ -1,5 +1,10 @@
2007-06-20 Jakub Jelinek <jakub@redhat.com>
PR middle-end/31959
* builtins.c: Include diagnostic.h.
(expand_builtin_expect): Make gcc_assert more permissive.
* Makefile.in (builtins.o): Depend on $(DIAGNOSTIC_H).
PR inline-asm/32109
* gimplify.c (gimplify_asm_expr): Issue error if type is addressable
and !allows_mem.

View File

@ -2329,7 +2329,7 @@ builtins.o : builtins.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(EXPR_H) $(OPTABS_H) insn-config.h $(RECOG_H) output.h typeclass.h \
hard-reg-set.h toplev.h hard-reg-set.h except.h $(TM_P_H) $(PREDICT_H) \
libfuncs.h $(REAL_H) langhooks.h $(BASIC_BLOCK_H) tree-mudflap.h \
$(BUILTINS_DEF) $(MACHMODE_H)
$(BUILTINS_DEF) $(MACHMODE_H) $(DIAGNOSTIC_H)
calls.o : calls.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(TREE_H) $(FLAGS_H) $(EXPR_H) $(OPTABS_H) langhooks.h $(TARGET_H) \
libfuncs.h $(REGS_H) toplev.h output.h $(FUNCTION_H) $(TIMEVAR_H) $(TM_P_H) \

View File

@ -50,6 +50,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#include "tree-mudflap.h"
#include "tree-flow.h"
#include "value-prof.h"
#include "diagnostic.h"
#ifndef PAD_VARARGS_DOWN
#define PAD_VARARGS_DOWN BYTES_BIG_ENDIAN
@ -5121,7 +5122,8 @@ expand_builtin_expect (tree exp, rtx target)
target = expand_expr (arg, target, VOIDmode, EXPAND_NORMAL);
/* When guessing was done, the hints should be already stripped away. */
gcc_assert (!flag_guess_branch_prob);
gcc_assert (!flag_guess_branch_prob
|| optimize == 0 || errorcount || sorrycount);
return target;
}

View File

@ -1,5 +1,8 @@
2007-06-20 Jakub Jelinek <jakub@redhat.com>
PR middle-end/31959
* gcc.dg/pr31959.c: New test.
PR inline-asm/32109
* g++.dg/ext/asm10.C: New test.

View File

@ -0,0 +1,20 @@
/* PR middle-end/31959 */
/* { dg-do compile } */
/* { dg-options "-O0 -fguess-branch-probability" } */
struct A { int i; };
static inline struct A *
bar (struct A *x)
{
return x;
}
void *
foo (struct A *x, int y)
{
void *p = (void *) 0;
if (__builtin_expect (y >= 6, 0))
p = bar (x);
return p;
}