Bug 38771 - [4.4 regression] error: non-trivial conversion in unary operation
Summary: [4.4 regression] error: non-trivial conversion in unary operation
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.4.0
: P1 normal
Target Milestone: 4.4.0
Assignee: Jakub Jelinek
URL:
Keywords: ice-checking, wrong-code
Depends on:
Blocks:
 
Reported: 2009-01-09 00:34 UTC by John Regehr
Modified: 2009-01-09 14:02 UTC (History)
1 user (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2009-01-09 08:54:39


Attachments
gcc44-pr38771.patch (575 bytes, patch)
2009-01-09 09:04 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Regehr 2009-01-09 00:34:11 UTC
Seen using r143187 on Ubuntu Hardy on x86.

regehr@john-home:~/volatile/tmp116$ current-gcc -O0 -c small.c
small.c: In function ‘foo’:
small.c:1: error: non-trivial conversion in unary operation
long long unsigned int
long long int
iftmp.0 = -p_37.1;

small.c:1: error: non-trivial conversion in unary operation
long long unsigned int
long long int
iftmp.0 = -p_37;

small.c:1: internal compiler error: verify_gimple failed
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

regehr@john-home:~/volatile/tmp116$ cat small.c

unsigned long long foo (long long p_37)
{
  return -(unsigned long long) (p_37 ? : p_37);
}

regehr@john-home:~/volatile/tmp116$ current-gcc -v

Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../configure --program-prefix=current- --enable-languages=c,c++ --prefix=/home/regehr : (reconfigured) ../configure --program-prefix=current- --enable-languages=c,c++ --prefix=/home/regehr : (reconfigured) ../configure --program-prefix=current- --enable-languages=c,c++ --prefix=/home/regehr : (reconfigured) ../configure --program-prefix=current- --prefix=/home/regehr --enable-languages=c,c++ --no-create --no-recursion : (reconfigured) ../configure --program-prefix=current- --prefix=/home/regehr --enable-languages=c,c++ --no-create --no-recursion : (reconfigured) ../configure --program-prefix=current- --prefix=/home/regehr --enable-languages=c,c++ --no-create --no-recursion : (reconfigured) ../configure --program-prefix=current- --prefix=/home/regehr --enable-languages=c,c++ --no-create --no-recursion : (reconfigured) ../configure --program-prefix=current- --prefix=/home/regehr --enable-languages=c,c++ --no-create --no-recursion
Thread model: posix
gcc version 4.4.0 20090108 (experimental) (GCC)
Comment 1 Jakub Jelinek 2009-01-09 08:54:39 UTC
fold_unary bug.
Comment 2 Jakub Jelinek 2009-01-09 09:04:44 UTC
Created attachment 17063 [details]
gcc44-pr38771.patch

Fix.
Comment 3 Jakub Jelinek 2009-01-09 13:41:27 UTC
Subject: Bug 38771

Author: jakub
Date: Fri Jan  9 13:41:08 2009
New Revision: 143202

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=143202
Log:
	PR middle-end/38771
	* fold-const.c (fold_unary): For COMPOUND_EXPR and COND_EXPR,
	fold_convert arg0 operands to TREE_TYPE (op0) first.

	* gcc.c-torture/compile/pr38771.c: New test.

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr38771.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/fold-const.c
    trunk/gcc/testsuite/ChangeLog

Comment 4 Jakub Jelinek 2009-01-09 14:02:45 UTC
Fixed.