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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
             Target|                            |x86_64-*-*, i?86-*-*
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2018-01-24
                 CC|                            |hubicka at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org,
                   |                            |rguenth at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Somehow switch-conversion doesn't transform the switch with -f{PIE,PIC}. 
Without
we get

phy_modes (phy_interface_t interface)
{
  const char * _1;
  const char * _4;

  <bb 2> [local count: 1073741825]:
  if (interface_2(D) <= 22)
    goto <bb 3>; [50.00%]
  else
    goto <bb 4>; [50.00%]

  <bb 3> [local count: 536870912]:
  _4 = CSWTCH.0[interface_2(D)];

  <bb 4> [local count: 1073741825]:
  # _1 = PHI <_4(3), "unknown"(2)>
  return _1;

due to

Bailing out - value from a case would need runtime relocations

                  reloc = initializer_constant_valid_p (val, TREE_TYPE (val));
                  if ((flag_pic && reloc != null_pointer_node)
                      || (!flag_pic && reloc == NULL_TREE))
                    {
                      if (reloc)
                        reason
                          = "value from a case would need runtime relocations";
                      else
                        reason
                          = "value from a case is not a valid initializer";
                    }

not sure why we need relocations for string constants?

Reply via email to