public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: optimization/7108: gcc 3.1 initialize two times the same variable
@ 2002-07-03 17:33 rth
0 siblings, 0 replies; 3+ messages in thread
From: rth @ 2002-07-03 17:33 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, nobody, quequero
Synopsis: gcc 3.1 initialize two times the same variable
State-Changed-From-To: open->closed
State-Changed-By: rth
State-Changed-When: Wed Jul 3 17:33:43 2002
State-Changed-Why:
Since you clearly didn't turn on optimization, what did you
expect?
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7108
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: optimization/7108: gcc 3.1 initialize two times the same variable
@ 2002-07-04 5:26 -=Quequero=-
0 siblings, 0 replies; 3+ messages in thread
From: -=Quequero=- @ 2002-07-04 5:26 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR optimization/7108; it has been noted by GNATS.
From: -=Quequero=- <quequero@linux.bitchx.it>
To: rth@gcc.gnu.org,gcc-bugs@gcc.gnu.org,gcc-prs@gcc.gnu.org,
nobody@gcc.gnu.org,quequero@linux.bitchx.it,gcc-gnats@gcc.gnu.org
Cc:
Subject: Re: optimization/7108: gcc 3.1 initialize two times the same
variable
Date: Thu, 04 Jul 2002 14:21:45 +0200
At 00.33 04/07/2002 +0000, you wrote:
> Since you clearly didn't turn on optimization, what did you
> expect?
>
>http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7108
yes i know optimization is off in my example...btw, optimization or not,
initializing two times
the same variable is always unuseful...I have reported this _bug_ only for
that :)
thanx a lot
-=Quequero=-
SpP/Member www.spippolatori.com
UIC Founder www.quequero.cjb.net
Linux Registered User #207978
Slackware User #12573
^ permalink raw reply [flat|nested] 3+ messages in thread
* optimization/7108: gcc 3.1 initialize two times the same variable
@ 2002-06-24 13:46 quequero
0 siblings, 0 replies; 3+ messages in thread
From: quequero @ 2002-06-24 13:46 UTC (permalink / raw)
To: gcc-gnats; +Cc: quequero
>Number: 7108
>Category: optimization
>Synopsis: gcc 3.1 initialize two times the same variable
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: unassigned
>State: open
>Class: pessimizes-code
>Submitter-Id: net
>Arrival-Date: Mon Jun 24 13:46:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: gcc 3.1 Thread model: single
>Release: 3.1
>Organization:
>Environment:
Linux 2.4.18 #16 Tue May 28 14:07:34 CEST 2002 i686
>Description:
Look here:
void function(char *string){
char buffer[100];
int i=0;
....
Now, let's disassemble it (i have used stripped and non-stripped version of the executable):
.text:08048492 push ebp
.text:08048493 mov ebp, esp
.text:08048495 sub esp, 98h
.text:0804849B mov [ebp+i], 0
.text:080484A2 mov [ebp+i], 0
the same variable is initiaziled twice :)
>How-To-Repeat:
i've discovered it compiling a silly program that i'm writing for a demonstration:
void overflow(char *string);
int main(int argv, char *argc[]){
overflow(argc[1]);
}
void overflow(char *string){
char buffer[100];
int i=0;
for(i=0; i<=100; i++)
buffer[i] = string[i];
printf("Typed: %s\n", buffer);
}
the disassembling the funciot "overflow" with IDA:
.text:0804849B mov [ebp+i], 0
.text:080484A2 mov [ebp+i], 0
i can see that "int i" is initialized twice to 0 but as you can see ebp doesn't change so that instruction shouldn't be there :P
>Fix:
i really don't know
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-07-04 12:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-03 17:33 optimization/7108: gcc 3.1 initialize two times the same variable rth
-- strict thread matches above, loose matches on Subject: below --
2002-07-04 5:26 -=Quequero=-
2002-06-24 13:46 quequero
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).