Bug 33726 - [4.3 Regression] Type checking error with address-of and volatile and arrays
Summary: [4.3 Regression] Type checking error with address-of and volatile and arrays
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: 4.3.0
Assignee: Richard Biener
URL:
Keywords: ice-checking, ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2007-10-10 13:25 UTC by Richard Biener
Modified: 2007-10-11 08:59 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2007-10-10 13:39:34


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Biener 2007-10-10 13:25:56 UTC
typedef unsigned int U032;
typedef volatile struct {
     U032 Monochrome[1];
     struct {
          U032 WidthHeight;
     } UnclippedRectangle[1];
} RivaBitmap;
void writel(void *);
void rivafb_fillrect(RivaBitmap *bm)
{
  writel(&bm->UnclippedRectangle[0].WidthHeight);
}

fbdev.3.i: In function 'rivafb_fillrect':
fbdev.3.i:11: warning: passing argument 1 of 'writel' discards qualifiers from pointer target type
fbdev.3.i:10: error: type mismatch in address expression
volatile U032 *

U032 *

D.1551 = &bm->UnclippedRectangle[0].WidthHeight
fbdev.3.i:10: 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.
Comment 1 Richard Biener 2007-10-10 13:39:34 UTC
The C FE strips qualifier in building the ARRAY_REF.  I have a patch.
Comment 2 Richard Biener 2007-10-11 08:11:36 UTC
Subject: Bug 33726

Author: rguenth
Date: Thu Oct 11 08:11:18 2007
New Revision: 129227

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=129227
Log:
2007-10-11  Richard Guenther  <rguenther@suse.de>

	PR c/33726
	* c-typeck.c (build_array_ref): Do not strip qualifiers from
	the array element type.

	* gcc.dg/pr33726.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/pr33726.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-typeck.c
    trunk/gcc/testsuite/ChangeLog

Comment 3 Richard Biener 2007-10-11 08:59:09 UTC
Fixed.