Bug 21419 - [4.0 Regression] Accepts writting to const via asm
Summary: [4.0 Regression] Accepts writting to const via asm
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: 4.0.3
Assignee: Paolo Bonzini
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: accepts-invalid
: 21420 21421 21422 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-05-06 14:43 UTC by Andrew Pinski
Modified: 2005-10-05 12:19 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 3.4.0 3.3.3 4.1.0 4.0.3
Known to fail: 4.0.0 4.0.2
Last reconfirmed: 2005-09-25 12:37:25


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Pinski 2005-05-06 14:43:34 UTC
The following code is accepted now in 4.0.0 and above but should not be:
void sigaddset(const int set)
{
        __asm__("" : "=m"(set) );
}
Comment 1 Andrew Pinski 2005-05-06 14:48:01 UTC
This also happens with the C++ front-end too.
Comment 2 Andrew Pinski 2005-05-06 14:57:38 UTC
(In reply to comment #1)
> This also happens with the C++ front-end too.
Which I filed as PR 21422 as I think it is a related issue but not fully the same bug.
Comment 3 Andrew Pinski 2005-05-09 20:46:21 UTC
: Search converges between 2004-05-11-trunk (#454) and 2004-05-14-trunk (#455).

So failing since the tree-ssa was merged in.
Comment 4 Paolo Bonzini 2005-09-25 12:36:56 UTC
*** Bug 21422 has been marked as a duplicate of this bug. ***
Comment 5 Paolo Bonzini 2005-09-25 12:41:10 UTC
*** Bug 21420 has been marked as a duplicate of this bug. ***
Comment 6 Paolo Bonzini 2005-09-25 12:41:44 UTC
*** Bug 21421 has been marked as a duplicate of this bug. ***
Comment 7 GCC Commits 2005-09-29 14:53:48 UTC
Subject: Bug 21419

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	bonzini@gcc.gnu.org	2005-09-29 14:53:39

Modified files:
	gcc            : ChangeLog gimplify.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg: pr21419.c 

Log message:
	gcc:
	2005-09-29  Paolo Bonzini  <bonzini@gnu.org>
	
	PR c/21419
	* gimplify.c (gimplify_asm_expr): Raise an error if an output is
	read-only.
	
	testsuite:
	2005-09-29  Paolo Bonzini  <bonzini@gnu.org>
	
	PR c/21419
	* gcc.dg/pr21419.c: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.10047&r2=2.10048
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/gimplify.c.diff?cvsroot=gcc&r1=2.154&r2=2.155
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.6113&r2=1.6114
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/pr21419.c.diff?cvsroot=gcc&r1=NONE&r2=1.1

Comment 8 Andrew Pinski 2005-09-29 16:20:03 UTC
Fixed at least on the mainline.
Comment 9 Paolo Bonzini 2005-09-30 08:51:32 UTC
Now committed to 4.0 branch as well.
Comment 10 GCC Commits 2005-09-30 08:54:16 UTC
Subject: Bug 21419

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	bonzini@gcc.gnu.org	2005-09-30 08:54:00

Modified files:
	gcc            : ChangeLog gimplify.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg: pr21419.c 

Log message:
	gcc:
	2005-09-30  Paolo Bonzini  <bonzini@gnu.org>
	
	PR c/21419
	* gimplify.c (gimplify_asm_expr): Raise an error if an output is
	read-only.
	
	testsuite:
	2005-09-30  Paolo Bonzini  <bonzini@gnu.org>
	
	PR c/21419
	* gcc.dg/pr21419.c: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.7592.2.438&r2=2.7592.2.439
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/gimplify.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.113.2.12&r2=2.113.2.13
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.419&r2=1.5084.2.420
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/pr21419.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1

Comment 11 Paolo Bonzini 2005-10-04 11:12:00 UTC
rth asked that this fix be moved to the front-end.  Also, the middle-end fix triggers PR24151.
Comment 12 Paolo Bonzini 2005-10-04 16:53:14 UTC
C and middle-end part was approved; I'd rather wait for C++ approval too before committing it, because committing the approved parts will reintroduce a C++ regressions.
Comment 13 GCC Commits 2005-10-05 12:17:20 UTC
Subject: Bug 21419

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	bonzini@gcc.gnu.org	2005-10-05 12:17:16

Modified files:
	gcc            : ChangeLog c-typeck.c gimplify.c 
	gcc/cp         : ChangeLog semantics.c 
	gcc/testsuite  : ChangeLog 
	gcc/testsuite/gcc.dg: asm-1.c pr21419.c 
Added files:
	gcc/testsuite/g++.dg/ext: asm7.C asm8.C 
	gcc/testsuite/gcc.dg: asm-pr24146.c 

Log message:
	2005-10-05  Paolo Bonzini  <bonzini@gnu.org>
	
	PR tree-optimization/21419
	PR tree-optimization/24146
	PR tree-optimization/24151
	
	* c-typeck.c (readonly_error): Handle USE being lv_asm.
	(build_asm_expr): Call it if outputs are read-only.
	* gimplify.c (gimplify_asm_expr): Remove former fix to PR 21419.
	
	cp:
	2005-10-05  Paolo Bonzini  <bonzini@gnu.org>
	
	PR tree-optimization/21419
	PR tree-optimization/24146
	PR tree-optimization/24151
	
	* semantics.c (finish_asm_stmt): Call readonly_error if outputs are
	read-only.  Set ASM_VOLATILE_P for asms without outputs.
	
	testsuite:
	2005-10-05  Paolo Bonzini  <bonzini@gnu.org>
	
	PR tree-optimization/21419
	PR tree-optimization/24146
	PR tree-optimization/24151
	
	* g++.dg/ext/asm7.C: New.
	* g++.dg/ext/asm8.C: New.
	* gcc.dg/asm-1.c: Compile on all targets.
	* gcc.dg/asm-pr24146.c: New.
	* gcc.dg/pr21419.c: Adjust error messages.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.10087&r2=2.10088
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-typeck.c.diff?cvsroot=gcc&r1=1.480&r2=1.481
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/gimplify.c.diff?cvsroot=gcc&r1=2.156&r2=2.157
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4912&r2=1.4913
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/semantics.c.diff?cvsroot=gcc&r1=1.490&r2=1.491
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.6140&r2=1.6141
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/asm7.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/asm8.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/asm-pr24146.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/asm-1.c.diff?cvsroot=gcc&r1=1.2&r2=1.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/pr21419.c.diff?cvsroot=gcc&r1=1.1&r2=1.2

Comment 14 Paolo Bonzini 2005-10-05 12:19:03 UTC
new fix committed
Comment 15 GCC Commits 2005-10-05 13:39:58 UTC
Subject: Bug 21419

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	bonzini@gcc.gnu.org	2005-10-05 13:39:51

Modified files:
	gcc            : ChangeLog c-typeck.c gimplify.c 
	gcc/cp         : ChangeLog semantics.c 
	gcc/testsuite  : ChangeLog 
	gcc/testsuite/gcc.dg: asm-1.c pr21419.c 
Added files:
	gcc/testsuite/g++.dg/ext: asm7.C asm8.C 
	gcc/testsuite/gcc.dg: asm-pr24146.c 

Log message:
	gcc:
	2005-10-05  Paolo Bonzini  <bonzini@gnu.org>
	
	PR tree-optimization/21419
	PR tree-optimization/24146
	PR tree-optimization/24151
	
	* c-typeck.c (readonly_error): Handle USE being lv_asm.
	(build_asm_expr): Call it if outputs are read-only.
	* gimplify.c (gimplify_asm_expr): Remove former fix to PR 21419.
	
	cp:
	2005-10-05  Paolo Bonzini  <bonzini@gnu.org>
	
	PR tree-optimization/21419
	PR tree-optimization/24146
	PR tree-optimization/24151
	
	* semantics.c (finish_asm_stmt): Call readonly_error if outputs are
	read-only.  Set ASM_VOLATILE_P for asms without outputs.
	
	testsuite:
	2005-10-05  Paolo Bonzini  <bonzini@gnu.org>
	
	PR tree-optimization/21419
	PR tree-optimization/24146
	PR tree-optimization/24151
	
	* g++.dg/ext/asm7.C: New.
	* g++.dg/ext/asm8.C: New.
	* gcc.dg/asm-1.c: Compile on all targets.
	* gcc.dg/asm-pr24146.c: New.
	* gcc.dg/pr21419.c: Adjust error messages.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.7592.2.447&r2=2.7592.2.448
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-typeck.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.419.2.13&r2=1.419.2.14
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/gimplify.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.113.2.13&r2=2.113.2.14
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.4648.2.116&r2=1.4648.2.117
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/semantics.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.463.2.10&r2=1.463.2.11
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.428&r2=1.5084.2.429
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/asm7.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/asm8.C.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/asm-pr24146.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/asm-1.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.1&r2=1.1.166.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/pr21419.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.1.2.1&r2=1.1.2.2