[Bug other/26828] New: missed diagnostic about unreachable code.

pluto at agmk dot net gcc-bugzilla@gcc.gnu.org
Thu Mar 23 16:37:00 GMT 2006


struct node { struct node* next; };

static inline
void destruct_list( struct node const* begin, struct node const* end )
{
    while ( begin != end )
    {
        begin = begin->next;
    }
}

int main()
{
    struct node n;
    n.next = &n;
    destruct_list(&n, 0);
    return 0;
}

bug.c.t97.final_cleanup:

main ()
{
  struct node * begin;
  struct node n;
<bb 0>:
  n.next = &n;
  begin = &n;
<L1>:;
  begin = begin->next;
  if (begin != 0B) goto <L1>; else goto <L4>;
<L4>:;
  return 0;
}

-Wunreachable-code reports nothing.


-- 
           Summary: missed diagnostic about unreachable code.
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: other
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pluto at agmk dot net
 GCC build triplet: *
  GCC host triplet: *
GCC target triplet: *


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26828



More information about the Gcc-bugs mailing list