Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #167068
| From | Kaz Kylheku <480-992-1380@kylheku.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: variable addresses on the stack |
| Date | 2022-08-19 20:58 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <20220819135226.125@kylheku.com> (permalink) |
| References | <54f99ed2-fe4d-4cab-944c-cb61799d64ecn@googlegroups.com> |
On 2022-08-19, Thiago Adams <thiago.adams@gmail.com> wrote:
> I am curious with the following..
>
> void f(int i) {
> if (i > 1) {
> int j ='a';
> }
> if (i < 1) {
> int k ='b';
> }
> }
> When I see the assembly ouput I can see the compiler
> use the address rbp-4 for j and rbp-8 for k
>
> Why not the same address considering that j and k don't exist
> at the same time?
> Any reason?
Nothing exists in the above; it is indistinguishable from
void f(int i) { }
and in the ideal circumstances, the optimized treatment
of it would be indistinguisahble from the like treatment
of the above.
If there is a difference, the compiler is not being operated in a way
which best reveals its abilities to remove dead code, or else is
somewhat lacking in those abilities.
--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
variable addresses on the stack Thiago Adams <thiago.adams@gmail.com> - 2022-08-19 10:22 -0700
Re: variable addresses on the stack Thiago Adams <thiago.adams@gmail.com> - 2022-08-19 10:27 -0700
Re: variable addresses on the stack Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2022-08-19 10:59 -0700
Re: variable addresses on the stack Thiago Adams <thiago.adams@gmail.com> - 2022-09-21 05:09 -0700
Re: variable addresses on the stack Thiago Adams <thiago.adams@gmail.com> - 2022-09-21 05:18 -0700
Re: variable addresses on the stack Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2022-09-21 15:30 -0700
Re: variable addresses on the stack David Brown <david.brown@hesbynett.no> - 2022-09-21 15:34 +0200
Re: variable addresses on the stack Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2022-09-21 15:23 -0700
Re: variable addresses on the stack Kaz Kylheku <480-992-1380@kylheku.com> - 2022-08-19 20:58 +0000
Re: variable addresses on the stack Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2022-08-19 15:47 -0600
Re: variable addresses on the stack Andrey Tarasevich <andreytarasevich@hotmail.com> - 2022-08-19 18:47 -0700
csiph-web