re PR c/28286 (ICE with invalid value in #pragma pack)

PR c/28286
	* c-pragma.c (handle_pragma_pack): Handle invalid constants.

	* gcc.dg/pragma-pack-4.c: New test.

From-SVN: r115548
This commit is contained in:
Volker Reichelt 2006-07-18 10:08:22 +00:00 committed by Volker Reichelt
parent e1cf56b1d9
commit 12050e4423
4 changed files with 20 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2006-07-18 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c/28286
* c-pragma.c (handle_pragma_pack): Handle invalid constants.
2006-07-18 Alexandre Oliva <aoliva@redhat.com>
PR c/26993

View File

@ -160,6 +160,8 @@ handle_pragma_pack (cpp_reader * ARG_UNUSED (dummy))
}
else if (token == CPP_NUMBER)
{
if (TREE_CODE (x) != INTEGER_CST)
GCC_BAD ("invalid constant in %<#pragma pack%> - ignored");
align = TREE_INT_CST_LOW (x);
action = set;
if (pragma_lex (&x) != CPP_CLOSE_PAREN)
@ -190,6 +192,8 @@ handle_pragma_pack (cpp_reader * ARG_UNUSED (dummy))
}
else if (token == CPP_NUMBER && action == push && align == -1)
{
if (TREE_CODE (x) != INTEGER_CST)
GCC_BAD ("invalid constant in %<#pragma pack%> - ignored");
align = TREE_INT_CST_LOW (x);
if (align == -1)
action = set;

View File

@ -1,3 +1,8 @@
2006-07-18 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c/28286
* gcc.dg/pragma-pack-4.c: New test.
2006-07-17 Steve Ellcey <sje@cup.hp.com>
PR c++/28291

View File

@ -0,0 +1,6 @@
/* PR c/28286 */
/* { dg-do compile } */
#pragma pack(0.5) /* { dg-warning "invalid constant" } */
#pragma pack(push,0.5) /* { dg-warning "invalid constant" } */
#pragma pack(push,x,0.5) /* { dg-warning "invalid constant" } */