public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c/9025: GNU C compiler does not honour 'const' type qualifier
@ 2002-12-20  7:06 d.petropoulos
  0 siblings, 0 replies; 7+ messages in thread
From: d.petropoulos @ 2002-12-20  7:06 UTC (permalink / raw)
  To: gcc-gnats


>Number:         9025
>Category:       c
>Synopsis:       GNU C compiler does not honour 'const' type qualifier
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          accepts-illegal
>Submitter-Id:   net
>Arrival-Date:   Fri Dec 20 07:06:30 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Dimitrios Petropoulos
>Release:        multiple
>Organization:
>Environment:
* Solaris 8, sparc, GCC 3.1
* AIX 4.3, PowerPC, GCC 2.9-aix51-020209
* Linux, x86, GCC 2.96
>Description:
The gcc compiler (multiple versions and platforms) does not honour the 'const' type qualifier (it allows the program to modify a variable declared as const). Depending on the scope of the declaration the effect of this can range from overwriting the variable which has been declared as constant to segmentation fault of the program (with associated overwriting of registers). The attached file causes a segmentation fault and overwrites the instruction pointer on Linux or the r0 register on PowerPC.
>How-To-Repeat:
Just compile (no special flags/directive needed)
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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

* Re: c/9025: GNU C compiler does not honour 'const' type qualifier
@ 2002-12-21  8:45 ehrhardt
  0 siblings, 0 replies; 7+ messages in thread
From: ehrhardt @ 2002-12-21  8:45 UTC (permalink / raw)
  To: d.petropoulos, gcc-bugs, gcc-prs, nobody

Synopsis: GNU C compiler does not honour 'const' type qualifier

State-Changed-From-To: analyzed->closed
State-Changed-By: cae
State-Changed-When: Sat Dec 21 08:45:26 2002
State-Changed-Why:
    Based on Joseph's comment. There is a proper warning that can be
    turned into an error with -pedantic-errors.
    

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9025


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

* Re: c/9025: GNU C compiler does not honour 'const' type qualifier
@ 2002-12-20 12:26 Joseph S. Myers
  0 siblings, 0 replies; 7+ messages in thread
From: Joseph S. Myers @ 2002-12-20 12:26 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c/9025; it has been noted by GNATS.

From: "Joseph S. Myers" <jsm28@cam.ac.uk>
To: <ehrhardt@mathematik.uni-ulm.de>,  <d.petropoulos@encode-sec.com>, 
     <gcc-bugs@gcc.gnu.org>,  <gcc-gnats@gcc.gnu.org>
Cc:  
Subject: Re: c/9025: GNU C compiler does not honour 'const' type qualifier
Date: Fri, 20 Dec 2002 20:20:23 +0000 (GMT)

 On 20 Dec 2002 ehrhardt@mathematik.uni-ulm.de wrote:
 
 >     Confirmed. All versions that I checked issue a warning for the assignment
 >     to a const value but this should be an error at least with std=c99 because
 
 No, it should be (and is) an error at least with -pedantic-errors, which
 is what you need to get an error for everything the standard requires a
 diagnostic for.  However, I don't see any point in this not being a hard
 error unconditionally and it's one case that is frequently requested to be
 such.
 
 -- 
 Joseph S. Myers
 jsm28@cam.ac.uk
 


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

* Re: c/9025: GNU C compiler does not honour 'const' type qualifier
@ 2002-12-20  8:03 ehrhardt
  0 siblings, 0 replies; 7+ messages in thread
From: ehrhardt @ 2002-12-20  8:03 UTC (permalink / raw)
  To: d.petropoulos, gcc-bugs, gcc-prs, nobody

Synopsis: GNU C compiler does not honour 'const' type qualifier

State-Changed-From-To: open->analyzed
State-Changed-By: cae
State-Changed-When: Fri Dec 20 08:03:53 2002
State-Changed-Why:
    Confirmed. All versions that I checked issue a warning for the assignment
    to a const value but this should be an error at least with std=c99 because
    6.5.16[#2] requires a modifiable lvalue as the left operand of an assignment
    and 6.3.2.1[#1] defines a modifiable lvalue as an lvalue that (among other
    things) doesn't have a const qualified type.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9025


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

* Re: c/9025: GNU C compiler does not honour 'const' type qualifier
@ 2002-12-20  7:43 ehrhardt
  0 siblings, 0 replies; 7+ messages in thread
From: ehrhardt @ 2002-12-20  7:43 UTC (permalink / raw)
  To: d.petropoulos, gcc-bugs, gcc-prs, nobody

Synopsis: GNU C compiler does not honour 'const' type qualifier

State-Changed-From-To: feedback->open
State-Changed-By: cae
State-Changed-When: Fri Dec 20 07:43:12 2002
State-Changed-Why:
    Attchement received.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9025


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

* RE: c/9025: GNU C compiler does not honour 'const' type qualifier
@ 2002-12-20  7:27 Dimitrios Petropoulos
  0 siblings, 0 replies; 7+ messages in thread
From: Dimitrios Petropoulos @ 2002-12-20  7:27 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c/9025; it has been noted by GNATS.

From: "Dimitrios Petropoulos" <d.petropoulos@encode-sec.com>
To: <ehrhardt@mathematik.uni-ulm.de>, <d.petropoulos@encode-sec.com>,
   <gcc-bugs@gcc.gnu.org>, <gcc-prs@gcc.gnu.org>, <nobody@gcc.gnu.org>,
   <gcc-gnats@gcc.gnu.org>
Cc:  
Subject: RE: c/9025: GNU C compiler does not honour 'const' type qualifier
Date: Fri, 20 Dec 2002 17:15:27 +0200

 This is a multi-part message in MIME format.
 
 ------=_NextPart_000_0003_01C2A84B.65267D30
 Content-Type: text/plain;
 	charset="us-ascii"
 Content-Transfer-Encoding: 7bit
 
 Sorry for the missing source file. Here it is...
 
 Happy holidays...
 
 -----------------------
 Dimitrios Petropoulos
 MSc InfoSec, CISSP
 
 Director, Security Research & Development
  
 ENCODE S.A.
 3, R.Melodou Str
 151 25 Marousi
 Athens, Greece
 Tel: +30210-6178410
 Fax: +30210-6109579
 web: www.encode-sec.com
 ------------------------
  
 
 > -----Original Message-----
 > From: ehrhardt@mathematik.uni-ulm.de 
 > [mailto:ehrhardt@mathematik.uni-ulm.de] 
 > Sent: Friday, December 20, 2002 5:10 PM
 > To: d.petropoulos@encode-sec.com; gcc-bugs@gcc.gnu.org; 
 > gcc-prs@gcc.gnu.org; nobody@gcc.gnu.org
 > Subject: Re: c/9025: GNU C compiler does not honour 'const' 
 > type qualifier
 > 
 > 
 > Synopsis: GNU C compiler does not honour 'const' type qualifier
 > 
 > State-Changed-From-To: open->feedback
 > State-Changed-By: cae
 > State-Changed-When: Fri Dec 20 07:10:08 2002
 > State-Changed-Why:
 >     The attachment is missing. Please send it to me privatly so that I
 >     can attach it to the report.   Thanks in advance  Christian
 > 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=g
 cc&pr=9025
 
 ------=_NextPart_000_0003_01C2A84B.65267D30
 Content-Type: text/plain;
 	name="foo.c.txt"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
 	filename="foo.c.txt"
 
 #include <stdio.h>
 const int foo = 0x10;
 int main()
 {
 	foo = 0x41414141;
 	printf("The value of foo is: %d\n", foo);
 }
 
 ------=_NextPart_000_0003_01C2A84B.65267D30--
 


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

* Re: c/9025: GNU C compiler does not honour 'const' type qualifier
@ 2002-12-20  7:10 ehrhardt
  0 siblings, 0 replies; 7+ messages in thread
From: ehrhardt @ 2002-12-20  7:10 UTC (permalink / raw)
  To: d.petropoulos, gcc-bugs, gcc-prs, nobody

Synopsis: GNU C compiler does not honour 'const' type qualifier

State-Changed-From-To: open->feedback
State-Changed-By: cae
State-Changed-When: Fri Dec 20 07:10:08 2002
State-Changed-Why:
    The attachment is missing. Please send it to me privatly so that I
    can attach it to the report.   Thanks in advance  Christian

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9025


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

end of thread, other threads:[~2002-12-21 16:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-20  7:06 c/9025: GNU C compiler does not honour 'const' type qualifier d.petropoulos
2002-12-20  7:10 ehrhardt
2002-12-20  7:27 Dimitrios Petropoulos
2002-12-20  7:43 ehrhardt
2002-12-20  8:03 ehrhardt
2002-12-20 12:26 Joseph S. Myers
2002-12-21  8:45 ehrhardt

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).