Incorrect generated code for conditional
Markus Trippelsdorf
markus@trippelsdorf.de
Sun Mar 16 16:29:00 GMT 2014
On 2014.03.16 at 09:20 -0700, Arthur Schwarz wrote:
>
>
> Win7 - 64bit
> gcc (GCC) 4.8.2
> g++ -w -DYYDEBUG=1 -DDEBUG_IOÂ Â -c -g -MMD -MP -MF "build/Debug/Cygwin-Windows/SlipRegister.o.d" -o build/Debug/Cygwin-Windows/SlipRegister.o SlipRegister.cpp
>
> There is no generated code for "retval = true;" in the conditional block. I am including the code fragment and disassembled code.
>
>
> If the issue seems to be a bug then I will include whatever additional data is required to help gcc identify the error. If it is not a bug then I truly apologize for wasting your time.
>
> What happens is that the conditional is executed but there is no required code.Â
>
> art
>
>
> --------------------- source code ----------------------
>
> Â bool SlipRegister::post(const string& name, SlipHeader& head) {
> Â Â Â Â Â bool retval = false;
> Â Â Â Â Â if (!head.isHeader()) {
> Â Â Â Â Â Â Â Â postError(SlipErr::E4002, "SlipRegister::post", "", "", head);Â Â
> Â Â Â Â Â } else {Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â // attempt to insert a new entry
> Â Â Â Â Â Â Â Â SlipAsciiEntry entry(name, &head, SlipHashEntry::DEFINED);
> Â Â Â Â Â Â Â Â SlipHash::ReturnTuple tuple = hashTable->insert(entry);
> Â Â Â Â Â Â Â Â if (tuple.condition == SlipHash::ReturnTuple::INSERTED) {
> Â Â Â Â Â Â Â Â Â Â Â retval == true;Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â // skipped over
retval = true;
--
Markus
More information about the Gcc
mailing list