Commit 12050e44 by Volker Reichelt Committed by Volker Reichelt

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
parent e1cf56b1
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> 2006-07-18 Alexandre Oliva <aoliva@redhat.com>
PR c/26993 PR c/26993
......
...@@ -160,6 +160,8 @@ handle_pragma_pack (cpp_reader * ARG_UNUSED (dummy)) ...@@ -160,6 +160,8 @@ handle_pragma_pack (cpp_reader * ARG_UNUSED (dummy))
} }
else if (token == CPP_NUMBER) 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); align = TREE_INT_CST_LOW (x);
action = set; action = set;
if (pragma_lex (&x) != CPP_CLOSE_PAREN) if (pragma_lex (&x) != CPP_CLOSE_PAREN)
...@@ -190,6 +192,8 @@ handle_pragma_pack (cpp_reader * ARG_UNUSED (dummy)) ...@@ -190,6 +192,8 @@ handle_pragma_pack (cpp_reader * ARG_UNUSED (dummy))
} }
else if (token == CPP_NUMBER && action == push && align == -1) 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); align = TREE_INT_CST_LOW (x);
if (align == -1) if (align == -1)
action = set; action = set;
......
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> 2006-07-17 Steve Ellcey <sje@cup.hp.com>
PR c++/28291 PR c++/28291
/* 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" } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment