public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/41476]  New: [4.5 regression] __typeof__ expands to const type
@ 2009-09-26 17:09 schwab at linux-m68k dot org
  2009-09-27 15:27 ` [Bug c/41476] [4.5 regression] __typeof__ expands to const type for function types schwab at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: schwab at linux-m68k dot org @ 2009-09-26 17:09 UTC (permalink / raw)
  To: gcc-bugs

When __typeof__ is applied to a conditional expression that contains a call to
a const function it expands to a const type.

$ cat tgmath.c
int foo (int) __attribute__ ((const));

void
test (void)
{
  __typeof__ (1 ? foo (0) : 0) texpr;
  texpr = 0;
}
$ gcc -c tgmath.c 
tgmath.c: In function ‘test’:
tgmath.c:7:3: error: assignment of read-only variable ‘texpr’


-- 
           Summary: [4.5 regression] __typeof__ expands to const type
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: schwab at linux-m68k dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41476


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/41476] [4.5 regression] __typeof__ expands to const type for function types
  2009-09-26 17:09 [Bug c/41476] New: [4.5 regression] __typeof__ expands to const type schwab at linux-m68k dot org
@ 2009-09-27 15:27 ` schwab at gcc dot gnu dot org
  2009-09-27 15:44 ` schwab at linux-m68k dot org
  2009-09-28 20:40 ` hjl at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: schwab at gcc dot gnu dot org @ 2009-09-27 15:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from schwab at gcc dot gnu dot org  2009-09-27 15:27 -------
Subject: Bug 41476

Author: schwab
Date: Sun Sep 27 15:27:08 2009
New Revision: 152220

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=152220
Log:
        PR c/41476
        * c-typeck.c (build_conditional_expr): Use the readonly and
        volatile flags of the operand types, not of the operands itself.

testsuite/:
        * gcc.dg/cond-constqual-1.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/cond-constqual-1.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-typeck.c
    trunk/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41476


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/41476] [4.5 regression] __typeof__ expands to const type for function types
  2009-09-26 17:09 [Bug c/41476] New: [4.5 regression] __typeof__ expands to const type schwab at linux-m68k dot org
  2009-09-27 15:27 ` [Bug c/41476] [4.5 regression] __typeof__ expands to const type for function types schwab at gcc dot gnu dot org
@ 2009-09-27 15:44 ` schwab at linux-m68k dot org
  2009-09-28 20:40 ` hjl at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: schwab at linux-m68k dot org @ 2009-09-27 15:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from schwab at linux-m68k dot org  2009-09-27 15:44 -------
Fixed.


-- 

schwab at linux-m68k dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.5.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41476


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/41476] [4.5 regression] __typeof__ expands to const type for function types
  2009-09-26 17:09 [Bug c/41476] New: [4.5 regression] __typeof__ expands to const type schwab at linux-m68k dot org
  2009-09-27 15:27 ` [Bug c/41476] [4.5 regression] __typeof__ expands to const type for function types schwab at gcc dot gnu dot org
  2009-09-27 15:44 ` schwab at linux-m68k dot org
@ 2009-09-28 20:40 ` hjl at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: hjl at gcc dot gnu dot org @ 2009-09-28 20:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from hjl at gcc dot gnu dot org  2009-09-28 20:39 -------
Subject: Bug 41476

Author: hjl
Date: Mon Sep 28 20:38:53 2009
New Revision: 152250

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=152250
Log:
2009-09-28  H.J. Lu  <hongjiu.lu@intel.com>

        Backport from mainline:
        2009-09-26  Andreas Schwab  <schwab@linux-m68k.org>

        PR c/41476
        * gcc.dg/cond-constqual-1.c: New test.

        2009-09-26  Michael Matz  <matz@suse.de>

        PR lto/40758
        PR middle-end/41470
        * gcc.dg/pr41470.c: New test.

        2009-09-23  Alexandre Oliva  <aoliva@redhat.com>

        PR debug/41248
        * gcc.dg/pr41248.c: New.

        2009-09-22  Alexandre Oliva  <aoliva@redhat.com>

        PR debug/41295
        * gcc.dg/pr41295.c: New.

        2009-09-20  Andrew Pinski  <pinskia@gcc.gnu.org>

        PR middle-end/40642
        * g++.dg/torture/pr40642.C: New testcase.

        2009-09-17  Michael Matz  <matz@suse.de>

        PR middle-end/41347
        * gfortran.dg/pr41347.f90: New test.

        2009-09-16  Michael Matz  <matz@suse.de>

        PR fortran/41212
        * gfortran.dg/pr41212.f90: New test.

        2009-09-11  Michael Matz  <matz@suse.de>

        PR middle-end/41275
        * g++.dg/tree-ssa/pr41275.C: New test.

        2009-09-11  Janus Weil  <janus@gcc.gnu.org>

        PR fortran/41242
        * gfortran.dg/proc_ptr_comp_21.f90: New.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/torture/pr40642.C
      - copied unchanged from r152249,
trunk/gcc/testsuite/g++.dg/torture/pr40642.C
    branches/gcc-4_4-branch/gcc/testsuite/g++.dg/tree-ssa/pr41275.C
      - copied unchanged from r152249,
trunk/gcc/testsuite/g++.dg/tree-ssa/pr41275.C
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/cond-constqual-1.c
      - copied unchanged from r152248,
trunk/gcc/testsuite/gcc.dg/cond-constqual-1.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/pr41248.c
      - copied unchanged from r152248, trunk/gcc/testsuite/gcc.dg/pr41248.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/pr41295.c
      - copied unchanged from r152249, trunk/gcc/testsuite/gcc.dg/pr41295.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/pr41470.c
      - copied unchanged from r152248, trunk/gcc/testsuite/gcc.dg/pr41470.c
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/pr41212.f90
      - copied unchanged from r152249,
trunk/gcc/testsuite/gfortran.dg/pr41212.f90
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/pr41347.f90
      - copied unchanged from r152249,
trunk/gcc/testsuite/gfortran.dg/pr41347.f90
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/proc_ptr_comp_21.f90
      - copied unchanged from r152249,
trunk/gcc/testsuite/gfortran.dg/proc_ptr_comp_21.f90
Modified:
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41476


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-09-28 20:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-26 17:09 [Bug c/41476] New: [4.5 regression] __typeof__ expands to const type schwab at linux-m68k dot org
2009-09-27 15:27 ` [Bug c/41476] [4.5 regression] __typeof__ expands to const type for function types schwab at gcc dot gnu dot org
2009-09-27 15:44 ` schwab at linux-m68k dot org
2009-09-28 20:40 ` hjl at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).