https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49401

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|2012-03-05 00:00:00         |2015-12-01
                 CC|                            |msebor at gcc dot gnu.org
      Known to work|                            |4.5.3
     Ever confirmed|0                           |1
      Known to fail|                            |4.7.0, 4.8.5, 4.9.3, 5.1.0,
                   |                            |6.0

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
Warning confirmed with GCC 4.8.5, 4.9.3, 5.1.0, and the latest trunk on both
x86_64 and powerpc64le (i.e., it's most likely not architecture specific).

GCC 4.5.3 doesn't complain.

The return type of foo() matters, as does the goto statement.

$ cat pr49401.c && /build/gcc-trunk-svn/gcc/xgcc -B /build/gcc-trunk-svn/gcc
-O2 -S -Wall -Werror -Wextra pr49401.c
extern int foo (void);

int mep_pragma_coprocessor_subclass (int *a)
{
  if (!a)
    goto error;

  int rclass;

  int c = foo ();

  if (c >= 0 && c <= 1)
    switch (c)
      {
      case 0:
        rclass = 0;
        break;
      case 1:
        rclass = 1;
        break;
      }
  else
    return 0;

  return a [rclass];

error:
  return 2;
}

Reply via email to