re PR c/38700 (ICE with __builtin_expect and label)

PR c/38700
	* builtins.c (fold_builtin_expect): Only check DECL_WEAK for VAR_DECLs
	and FUNCTION_DECLs.

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

From-SVN: r143028
This commit is contained in:
Jakub Jelinek 2009-01-03 01:52:51 +01:00 committed by Jakub Jelinek
parent fafe34f91a
commit 5f26a23027
4 changed files with 26 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2009-01-03 Jakub Jelinek <jakub@redhat.com>
PR c/38700
* builtins.c (fold_builtin_expect): Only check DECL_WEAK for VAR_DECLs
and FUNCTION_DECLs.
2009-01-02 Kenneth Zadeck <zadeck@naturalbridge.com>
PR rtl-optimization/35805

View file

@ -1,6 +1,6 @@
/* Expand builtin functions.
Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
Free Software Foundation, Inc.
This file is part of GCC.
@ -7324,7 +7324,9 @@ fold_builtin_expect (tree arg0, tree arg1)
}
while (TREE_CODE (inner) == COMPONENT_REF
|| TREE_CODE (inner) == ARRAY_REF);
if (DECL_P (inner) && DECL_WEAK (inner))
if ((TREE_CODE (inner) == VAR_DECL
|| TREE_CODE (inner) == FUNCTION_DECL)
&& DECL_WEAK (inner))
return NULL_TREE;
}

View file

@ -1,3 +1,8 @@
2009-01-03 Jakub Jelinek <jakub@redhat.com>
PR c/38700
* gcc.dg/pr38700.c: New test.
2009-01-02 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/initlist11.C: New test.

View file

@ -0,0 +1,11 @@
/* PR c/38700 */
/* { dg-do compile } */
/* { dg-options "-O0" } */
int
foo ()
{
__SIZE_TYPE__ s = __builtin_expect ((__SIZE_TYPE__)&&L, 0);
L:
return 0;
}