Bug 43082 - [4.3/4.4/4.5/4.6 Regression] ICE in tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p
Summary: [4.3/4.4/4.5/4.6 Regression] ICE in tree check: expected class 'type', have '...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: 4.6.0
Assignee: Nicola Pero
URL: http://gcc.gnu.org/ml/gcc-patches/201...
Keywords: error-recovery, ice-on-invalid-code, patch
Depends on:
Blocks:
 
Reported: 2010-02-15 15:46 UTC by Matthias Klose
Modified: 2011-02-02 17:55 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.1.2, 4.6.0
Known to fail: 4.3.5, 4.4.4, 4.5.1
Last reconfirmed: 2010-03-03 19:00:50


Attachments
preprocessed source (4.61 KB, application/x-gzip)
2010-02-15 15:47 UTC, Matthias Klose
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Klose 2010-02-15 15:46:45 UTC
seen with 4.3, 4.4 and trunk:

$ gcc -c main.i
main.c: In function 'main':
main.c:22:5: error: void value not ignored as it ought to be
main.c:22:5: error: void value not ignored as it ought to be
main.c:22:8: internal compiler error: tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at tree-ssa.c:1233
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-snapshot/README.Bugs> for instructions.
Comment 1 Matthias Klose 2010-02-15 15:47:06 UTC
Created attachment 19878 [details]
preprocessed source
Comment 2 Richard Biener 2010-02-16 10:21:57 UTC
We get

6493          STRIP_USELESS_TYPE_CONVERSION (*expr_p);
(gdb) call debug_tree (*expr_p)
 <nop_expr 0x7ffff5b99150
    type <boolean_type 0x7ffff7ee4888 _Bool public unsigned QI
        size <integer_cst 0x7ffff7ed2730 constant 8>
        unit size <integer_cst 0x7ffff7ed2758 constant 1>
        align 8 symtab 0 alias set -1 canonical type 0x7ffff7ee4888 precision 1 min <integer_cst 0x7ffff7ed2b68 0> max <integer_cst 0x7ffff7ed2bb8 1>>
   
    arg 0 <cond_expr 0x7ffff5b48280 type <error_mark 0x7ffff7edab70>


The FEs shouldn't feed us random crap really ...
Comment 3 Andrew Pinski 2010-03-03 19:00:50 UTC
Reduced testcase:
int main(void)
{
    int gpf;
    if(gpf ? (void) (0)  : f ()) ;
}
--- CUT ---
Looking into it.
Comment 4 Andrew Pinski 2010-03-03 19:02:55 UTC
I get:
t1.c:4:7: internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in get_narrower, at tree.c:7654

Now.
Comment 5 Andrew Pinski 2010-03-03 19:21:30 UTC
I have a patch to c_common_truthvalue_conversion which fixes this issue.
Comment 6 Andrew Pinski 2010-03-08 17:15:58 UTC
No longer working on this one.
Comment 7 Matthias Klose 2010-09-20 18:01:00 UTC
trunk 20100918 fails with:

gcc -g -O0 -c foo.c
foo.c: In function 'main':
foo.c:4:5: error: void value not ignored as it ought to be
foo.c:4:5: error: void value not ignored as it ought to be
foo.c:4:7: internal compiler error: tree check: expected class 'type', have 'exceptional' (error_mark) in get_narrower, at tree.c:7856
Please submit a full bug report,
with preprocessed source if appropriate.
Comment 8 Nicola Pero 2011-01-19 00:55:38 UTC
This is a regression since my stock RedHat gcc 4.1.2 compiler doesn't ICE.

I have a patch that should address Joseph's comments to Andrew's original
patch.  I'll submit it once it's finished testing.

Thanks
Comment 9 Nicola Pero 2011-01-27 02:09:19 UTC
Author: nicola
Date: Thu Jan 27 02:09:13 2011
New Revision: 169319

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=169319
Log:
In gcc/:
2011-01-26  Nicola Pero  <nicola.pero@meta-innovation.com>

	PR c/43082
	* c-typeck.c (c_objc_common_truthvalue_conversion): If we are
	passed a VOID_TYPE expression, immediately emit an error and
	return error_mark_node.

In gcc/testsuite/:
2011-01-26  Nicola Pero  <nicola.pero@meta-innovation.com>
	    Andrew Pinski  <pinskia@gmail.com>

	PR c/43082
	* gcc.dg/pr43082.c: New.

Added:
    trunk/gcc/testsuite/gcc.dg/pr43082.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-typeck.c
    trunk/gcc/testsuite/ChangeLog
Comment 10 Nicola Pero 2011-01-28 00:08:01 UTC
Fixed in GCC trunk/4.6.0.

Thanks
Comment 11 Diego Novillo 2011-02-02 17:55:59 UTC
Author: dnovillo
Date: Wed Feb  2 17:55:55 2011
New Revision: 169639

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=169639
Log:
In gcc/:
2011-01-26  Nicola Pero  <nicola.pero@meta-innovation.com>

	PR c/43082
	* c-typeck.c (c_objc_common_truthvalue_conversion): If we are
	passed a VOID_TYPE expression, immediately emit an error and
	return error_mark_node.

In gcc/testsuite/:
2011-01-26  Nicola Pero  <nicola.pero@meta-innovation.com>
	    Andrew Pinski  <pinskia@gmail.com>

	PR c/43082
	* gcc.dg/pr43082.c: New.

Added:
    branches/google/integration/gcc/testsuite/gcc.dg/pr43082.c
Modified:
    branches/google/integration/gcc/ChangeLog
    branches/google/integration/gcc/c-typeck.c
    branches/google/integration/gcc/testsuite/ChangeLog