ICE optimizing widening multiply-and-accumulate

Bug #843775 reported by Andrew Stubbs on 2011-09-07
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Linaro GCC
Fix Released
High
Andrew Stubbs
4.6-2011.07-stable
Invalid
Undecided
Unassigned
gcc
Fix Released
Medium

Bug Description

The widening mulitply pass creates a bad expression when using constants with
types that don't match the other operand:

(This testcase is reduced from the Linux kernel)

long long test (unsigned int sec, unsigned long long nsecs)
{
 return (long long)(long)sec * 1000000000L + (long long)(unsigned
long)nsecs;
}

dummy.i: In function ‘test’:
dummy.i:2:11: error: type mismatch in widening multiply-accumulate
expression
long long int
unsigned int
long int
long long int
D.4708_8 = WIDEN_MULT_PLUS_EXPR <sec_1(D), 1000000000, D.4720_11>;

dummy.i:2:11: internal compiler error: verify_gimple failed

The widening mulitply pass creates a bad expression when using constants with types that don't match the other operand:

(This testcase is reduced from the Linux kernel)

long long test (unsigned int sec, unsigned long long nsecs)
{
 return (long long)(long)sec * 1000000000L + (long long)(unsigned
long)nsecs;
}

dummy.i: In function ‘test’:
dummy.i:2:11: error: type mismatch in widening multiply-accumulate
expression
long long int
unsigned int
long int
long long int
D.4708_8 = WIDEN_MULT_PLUS_EXPR <sec_1(D), 1000000000, D.4720_11>;

dummy.i:2:11: internal compiler error: verify_gimple failed

The problem is a bug in my recent widening-multiplies patch. :(

Changed in gcc:
importance: Unknown → Medium
status: Unknown → In Progress
Michael Hope (michaelh1) on 2011-09-07
Changed in gcc-linaro:
importance: Undecided → High
Michael Hope (michaelh1) wrote :

Hi Andrew. What architecture does this occur on and with what flags? I can't reproduce it with a cross arm-linux-gnueabi gcc-linaro-4.6+bzr106800 at -O2 or -O3.

This bug is really upstream GCC trunk. However, if it's not reproducible in 4.6, then it's dormant rather than not-a-problem.

Author: ams
Date: Thu Sep 8 19:45:37 2011
New Revision: 178708

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=178708
Log:
2011-09-08 Andrew Stubbs <email address hidden>

 PR tree-optimization/50318

 gcc/
 * tree-ssa-math-opts.c (convert_plusminus_to_widen): Correct
 typo in use of mult_rhs1 and mult_rhs2.

 gcc/testsuite/
 * gcc.target/arm/pr50318-1.c: New file.

Added:
    trunk/gcc/testsuite/gcc.target/arm/pr50318-1.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-math-opts.c

This should be resolved now.

Changed in gcc:
status: In Progress → Fix Released
Michael Hope (michaelh1) on 2011-09-14
Changed in gcc-linaro:
status: In Progress → Fix Committed
Michael Hope (michaelh1) on 2011-09-16
Changed in gcc-linaro:
status: Fix Committed → Fix Released
Michael Hope (michaelh1) wrote :

Original feature isn't in the stable branch.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.