public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Incorrect generated code for conditional
@ 2014-03-16 16:23 Arthur Schwarz
  2014-03-16 16:29 ` Markus Trippelsdorf
  2014-03-16 18:48 ` Jonathan Wakely
  0 siblings, 2 replies; 3+ messages in thread
From: Arthur Schwarz @ 2014-03-16 16:23 UTC (permalink / raw)
  To: gcc



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
         } else if (tuple.condition == SlipHash::ReturnTuple::FOUND) {
            if (fsm(*tuple.entry, SlipHashEntry::DEFINED)) {
               ((SlipHeader*)((tuple.entry)->getBinaryKey()))->moveListRight(head);
               head.deleteList();
               retval = true;
            } else if ((tuple.entry)->getType() == SlipHashEntry::USERDATA) {
               postError(SlipErr::E4001, "SlipRegister::post", "", "", head);   
            } else {
               postError(SlipErr::E4015, "SlipRegister::post", "", "", head);   
            };
         }
      }
      DEBUG(debugFlag,
         cout << sFlag[retval] << "post(" << name << ", " << head.toString() 
              << ") " << endl;)
      return retval;
   }; // bool SlipRegister::post(const string& name, SlipHeader& head, bool defineFlag)




--------------- disassembled code fragment ------------

   !         SlipHash::ReturnTuple tuple = hashTable->insert(entry);
slip::SlipRegister::post(std::string const&, slip::SlipHeader&)+337: mov    0xb0(%rbp),%rax
slip::SlipRegister::post(std::string const&, slip::SlipHeader&)+344: mov    (%rax),%rdx
slip::SlipRegister::post(std::string const&, slip::SlipHeader&)+347: lea    -0x20(%rbp),%rax
slip::SlipRegister::post(std::string const&, slip::SlipHeader&)+351: lea    -0x50(%rbp),%rcx
slip::SlipRegister::post(std::string const&, slip::SlipHeader&)+355: mov    %rcx,%r8
slip::SlipRegister::post(std::string const&, slip::SlipHeader&)+358: mov    %rax,%rcx
slip::SlipRegister::post(std::string const&, slip::SlipHeader&)+361: callq  0x10042d316 <slip::SlipHash::insert(slip::SlipHashEntry&)>
slip::SlipRegister::post(std::string const&, slip::SlipHeader&)+987: lea    -0x20(%rbp),%rax
slip::SlipRegister::post(std::string const&, slip::SlipHeader&)+991: mov    %rax,%rcx
slip::SlipRegister::post(std::string const&, slip::SlipHeader&)+994: callq  0x1004e6c60 <slip::SlipHash::ReturnTuple::~ReturnTuple()>
slip::SlipRegister::post(std::string const&, slip::SlipHeader&)+1509: lea    -0x20(%rbp),%rax
slip::SlipRegister::post(std::string const&, slip::SlipHeader&)+1513: mov    %rax,%rcx
slip::SlipRegister::post(std::string const&, slip::SlipHeader&)+1516: callq  0x1004e6c60 <slip::SlipHash::ReturnTuple::~ReturnTuple()>
slip::SlipRegister::post(std::string const&, slip::SlipHeader&)+1521: jmp    0x10045c4e4 <slip::SlipRegister::post(std::string const&, slip::SlipHeader&)+1526>
slip::SlipRegister::post(std::string const&, slip::SlipHeader&)+1523: mov    %rax,%rbx
!         if (tuple.condition == SlipHash::ReturnTuple::INSERTED) {
slip::SlipRegister::post(std::string const&, slip::SlipHeader&)+366: mov    -0x14(%rbp),%eax
slip::SlipRegister::post(std::string const&, slip::SlipHeader&)+369: cmp    $0x4,%eax
slip::SlipRegister::post(std::string const&, slip::SlipHeader&)+372: je     0x10045c2c9 <slip::SlipRegister::post(std::string const&, slip::SlipHeader&)+987>
!            retval == true;
!         } else if (tuple.condition == SlipHash::ReturnTuple::FOUND) {

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

* Re: Incorrect generated code for conditional
  2014-03-16 16:23 Incorrect generated code for conditional Arthur Schwarz
@ 2014-03-16 16:29 ` Markus Trippelsdorf
  2014-03-16 18:48 ` Jonathan Wakely
  1 sibling, 0 replies; 3+ messages in thread
From: Markus Trippelsdorf @ 2014-03-16 16:29 UTC (permalink / raw)
  To: Arthur Schwarz; +Cc: gcc

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

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

* Re: Incorrect generated code for conditional
  2014-03-16 16:23 Incorrect generated code for conditional Arthur Schwarz
  2014-03-16 16:29 ` Markus Trippelsdorf
@ 2014-03-16 18:48 ` Jonathan Wakely
  1 sibling, 0 replies; 3+ messages in thread
From: Jonathan Wakely @ 2014-03-16 18:48 UTC (permalink / raw)
  To: Arthur Schwarz; +Cc: gcc

On 16 March 2014 16:20, Arthur Schwarz wrote:
> 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.

It's not a bug, as you could easily have discovered by using -Wall to
enable warnings. Even if it was a bug, posting bugs to this mailing
list is not appropriate.

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

end of thread, other threads:[~2014-03-16 18:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-16 16:23 Incorrect generated code for conditional Arthur Schwarz
2014-03-16 16:29 ` Markus Trippelsdorf
2014-03-16 18:48 ` Jonathan Wakely

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