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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |kcc at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Short testcase for #c3:

int
foo (int x)
{
  int v = 0;
  switch (x)
    {
    case 11: v = 67; break;
    case 12: v = 68; break;
    case 13: v = 69; break;
    }
  return v;
}

int
bar (int x)
{
  int v = 0;
  switch (x)
    {
    case 18: v = 67; break;
    case 19: v = 68; break;
    case 20: v = 69; break;
    }
  return v;
}

int
main ()
{
  return foo (11) - 67 + bar (19) - 68;
}

reports that there is an ODR violation, though:
1) there is no such thing as ODR in C or Fortran, I wonder how can you apply by
default something like that without letting the compiler to pass through the
language of the vars
2) I don't see how that is anything close to an ODR violation; there are two
vars, CSWTCH.1 and CSWTCH.3, which, sometimes because of compiler decision,
sometimes unified by linker, have the same beginning address.  What does that
have to do with ODR?  Each of the vars has different definition, but they are
read-only and not address taken, so they can share the data.  GCC with
-fmerge-all-constants also merges many read-only constants, even addressable
ones, when they have the same content.

Reply via email to