diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-01-26 20:06:57 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-01-26 20:06:57 +0000 |
commit | a12319b31fb61d996c0d43dc2489a32af2f23ed2 (patch) | |
tree | 1a382eef761458761e42465c78ca92bf5de32aa3 /gcc/c-family/c-lex.c | |
parent | 37a21896106fe0672e43cdb2fbba7d831bcef94a (diff) | |
download | gcc-a12319b31fb61d996c0d43dc2489a32af2f23ed2.tar.gz |
PR c/47473
* c-lex.c (interpret_float): If CPP_N_IMAGINARY, ensure
EXCESS_PRECISION_EXPR is created with COMPLEX_TYPE instead of
REAL_TYPE.
* gcc.dg/torture/pr47473.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@169299 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-family/c-lex.c')
-rw-r--r-- | gcc/c-family/c-lex.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/gcc/c-family/c-lex.c b/gcc/c-family/c-lex.c index 778e4246749..1ea57f1cdda 100644 --- a/gcc/c-family/c-lex.c +++ b/gcc/c-family/c-lex.c @@ -1,7 +1,7 @@ /* Mainly the interface between cpplib and the C front ends. Copyright (C) 1987, 1988, 1989, 1992, 1994, 1995, 1996, 1997 - 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. + 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, + 2011 Free Software Foundation, Inc. This file is part of GCC. @@ -752,8 +752,15 @@ interpret_float (const cpp_token *token, unsigned int flags) /* Create a node with determined type and value. */ value = build_real (const_type, real); if (flags & CPP_N_IMAGINARY) - value = build_complex (NULL_TREE, convert (const_type, integer_zero_node), - value); + { + value = build_complex (NULL_TREE, convert (const_type, + integer_zero_node), value); + if (type != const_type) + { + const_type = TREE_TYPE (value); + type = build_complex_type (type); + } + } if (type != const_type) value = build1 (EXCESS_PRECISION_EXPR, type, value); |