1  /* Verify that we clarify the sense of paths involving strcmp.  */
       2  
       3  #include <string.h>
       4  #include <stdlib.h>
       5  
       6  int test_1 (const char *str, char *ptr)
       7  {
       8    if (strcmp (str, "VALUE")) /* { dg-message "following 'true' branch \\(when the strings are non-equal\\)\\.\\.\\." } */
       9      free (ptr);
      10    free (ptr); /* { dg-warning "double-'free' of 'ptr'" } */
      11  }
      12  
      13  int test_2 (const char *str, char *ptr)
      14  {
      15    if (strcmp (str, "VALUE") == 0) /* { dg-message "following 'true' branch \\(when the strings are equal\\)\\.\\.\\." } */
      16      free (ptr);
      17    free (ptr); /* { dg-warning "double-'free' of 'ptr'" } */
      18  }
      19  
      20  int test_3 (const char *str, char *ptr)
      21  {
      22    if (!strcmp (str, "VALUE")) /* { dg-message "following 'true' branch \\(when the strings are equal\\)\\.\\.\\." } */
      23      free (ptr);
      24    free (ptr); /* { dg-warning "double-'free' of 'ptr'" } */
      25  }
      26  
      27  int test_4 (const char *str, char *ptr)
      28  {
      29    if (strcmp (str, "VALUE")) /* { dg-message "following 'false' branch \\(when the strings are equal\\)\\.\\.\\." } */
      30      {
      31      }
      32    else
      33      free (ptr);
      34    free (ptr); /* { dg-warning "double-'free' of 'ptr'" } */
      35  }