There are several verify_stmts failed problems pending, but this one looks different. Apologies if it's a dup. [regehr@gamow tmp434]$ current-gcc -c -O2 small.c small.c: In function 'uint321': small.c:33:5: error: conversion of register to a different size VIEW_CONVERT_EXPR<int>(D.2762_32); pretmp.6_33 = VIEW_CONVERT_EXPR<int>(D.2762_32); small.c:33:5: internal compiler error: verify_stmts failed Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. [regehr@gamow tmp434]$ current-gcc -v Using built-in specs. COLLECT_GCC=current-gcc COLLECT_LTO_WRAPPER=/uusoc/exports/scratch/regehr/z/compiler-install/gcc-r168380-install/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.6.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../configure --with-libelf=/usr/local --enable-lto --prefix=/home/regehr/z/compiler-install/gcc-r168380-install --program-prefix=r168380- --enable-languages=c,c++ Thread model: posix gcc version 4.6.0 20101231 (experimental) (GCC) [regehr@gamow tmp434]$ cat small.c typedef short int int16_t; typedef int int32_t; typedef unsigned char uint8_t; typedef unsigned short int uint16_t; static int32_t safe_mod_func_int32_t_s_s (int32_t si1, int16_t si2) { return si2 == 0 || si1 == -2147483647 - 1 && si2 ? si1 : si1 + si2; } static uint8_t safe_add_func_uint8_t_u_u (uint8_t ui1, uint8_t ui2) { return ui1 + ui2; } static uint16_t safe_sub_func_uint16_t_u_u (uint16_t ui1, uint8_t ui2) { return ui1 - ui2; } int16_t g_32; int16_t g_76[7][10] = { }; volatile int32_t g_98[1][1] = { }; volatile int32_t *g_97 = &g_98[0][0]; int uint321 (void) { for (0;; 1) *g_97 = safe_mod_func_int32_t_s_s (safe_add_func_uint8_t_u_u (1, func_21 (g_32, g_76[5][5])) >= safe_sub_func_uint16_t_u_u (&g_97 == 0, 1), 0); }
Caused by http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162943 Smaller testcase: static int foo (int x, short y) { return y == 0 ? x : x + y; } static unsigned short bar (unsigned short x, unsigned char y) { return x - y; } int w; int baz (void); int test (void) { for (;;) w = foo ((unsigned char) (1 + baz ()) >= bar (0, 1), 0); }
Created attachment 22877 [details] gcc46-pr47140.patch Untested fix.
Author: jakub Date: Sun Jan 2 17:09:08 2011 New Revision: 168402 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=168402 Log: PR tree-optimization/47140 * tree-ssa-ccp.c (evaluate_stmt): For binary assignments, use TREE_TYPE (lhs) instead of TREE_TYPE (rhs1) as second argument to bit_value_binop. * gcc.c-torture/compile/pr47140.c: New test. Added: trunk/gcc/testsuite/gcc.c-torture/compile/pr47140.c Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-ssa-ccp.c
Fixed.