[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [avr-gcc-list] Re: Inline vs. ? : operator
From: |
Weddington, Eric |
Subject: |
RE: [avr-gcc-list] Re: Inline vs. ? : operator |
Date: |
Tue, 30 Mar 2010 06:54:52 -0600 |
> -----Original Message-----
> From:
> address@hidden
> [mailto:address@hidden
> org] On Behalf Of David Brown
> Sent: Saturday, March 27, 2010 5:34 PM
> To: Szikra Istvan; address@hidden
> Subject: Re: [avr-gcc-list] Re: Inline vs. ? : operator
>
> > My other problem with this is, it only "returns a value" when it's
> > executed indirectly (contained in a function, that provides it's c
> > parameter as a variable!). For example it does not generate an 'in'
> > instruction in the main program (function). If you were right about
> > that ?: should read the volatile twice, then it should happen at the
> > first bit_write() statement in the main function too.
> >
>
> I didn't notice this earlier. But this behaviour, I believe, is the
> erroneous behaviour.
>
> It would seem that this situation is not entirely clear - the
> compiler
> should at least be consistent. But it's not obvious what the correct
> behaviour should be. Note that we are concerned here about getting
> /correct/ code - not necessarily the smallest and fastest code.
>
> Perhaps some of those more familiar with the internals of gcc
> and/or the
> C standards may like to comment. Otherwise, I'd recommend
> avoiding the
> ?: operator with volatiles - stick to code that you know
> works correctly
> and optimally.
>
I will only comment on this when I see a well-formed bug report in the GCC bug
database:
<http://gcc.gnu.org/bugzilla/>
It must include a buildable test case that shows the alleged issue.