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

            Bug ID: 67750
           Summary: undefined local label
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pangbw at gmail dot com
  Target Milestone: ---

Steps to reproduce:
1. cat 1.c
typedef unsigned int size_t;
typedef struct y4m_input y4m_input;
typedef void (*y4m_convert_func)(y4m_input *_y4m,
                                 unsigned char *_dst, unsigned char *_src);

  typedef enum vpx_img_fmt {
    VPX_IMG_FMT_NONE,
    VPX_IMG_FMT_RGB24,
    VPX_IMG_FMT_RGB32,
    VPX_IMG_FMT_RGB565,
    VPX_IMG_FMT_RGB555,
    VPX_IMG_FMT_UYVY,
    VPX_IMG_FMT_YUY2,
    VPX_IMG_FMT_YVYU,
    VPX_IMG_FMT_BGR24,
    VPX_IMG_FMT_RGB32_LE,
    VPX_IMG_FMT_ARGB,
    VPX_IMG_FMT_ARGB_LE,
    VPX_IMG_FMT_RGB565_LE,
    VPX_IMG_FMT_RGB555_LE,
    VPX_IMG_FMT_YV12 = 0x100 | 0x200 | 1,
    VPX_IMG_FMT_I420 = 0x100 | 2,
    VPX_IMG_FMT_VPXYV12 = 0x100 | 0x200 | 3,
    VPX_IMG_FMT_VPXI420 = 0x100 | 4,
    VPX_IMG_FMT_I422 = 0x100 | 5,
    VPX_IMG_FMT_I444 = 0x100 | 6,
    VPX_IMG_FMT_444A = 0x100 | 0x400 | 7
  } vpx_img_fmt_t;

struct y4m_input {
  int pic_w;
  int pic_h;
  int fps_n;
  int fps_d;
  int par_n;
  int par_d;
  char interlace;
  int src_c_dec_h;
  int src_c_dec_v;
  int dst_c_dec_h;
  int dst_c_dec_v;
  char chroma_type[16];
  size_t dst_buf_sz;
  size_t dst_buf_read_sz;
  size_t aux_buf_sz;
  size_t aux_buf_read_sz;
  y4m_convert_func convert;
  unsigned char *dst_buf;
  unsigned char *aux_buf;
  enum vpx_img_fmt vpx_fmt;
  int vpx_bps;
};

void y4m_convert_mono_420jpeg(y4m_input *_y4m, unsigned char *_dst,
                                     unsigned char *_aux) {
  int c_sz;
  _dst += _y4m->pic_w * _y4m->pic_h;
  c_sz = ((_y4m->pic_w + _y4m->dst_c_dec_h - 1) / _y4m->dst_c_dec_h) *
         ((_y4m->pic_h + _y4m->dst_c_dec_v - 1) / _y4m->dst_c_dec_v);
  memset(_dst, 128, c_sz * 2);
}

2. ./xgcc -m32 -mcpu=8548 -mabi=spe -mspe -mfloat-gprs=double -O2 -pipe -g
-fno-omit-frame-pointer -fvisibility=default -fstack-protector-all
-D_FORTIFY_SOURCE=2 -v -O3 -fPIC -Wall -Wdeclaration-after-statement
-Wdisabled-optimization -Wpointer-arith -Wtype-limits -Wcast-qual -Wvla
-Wimplicit-function-declaration -Wuninitialized -Wunused-variable
-Wunused-but-set-variable -Wno-unused-function -S 1.c -o 1.s

3. In 1.s we can see the local label "LCL0" is referenced in several places but
not defined in anywhere.


./xgcc -v
Using built-in specs.
COLLECT_GCC=./xgcc
Target: powerpc-abc-linuxeabispe
Configured with: ../gcc-4.9.1/configure --build=x86_64-pc-linux
--host=x86_64-pc-linux --target=powerpc-abc-linuxeabispe
--with-glibc-version=2.5
Thread model: posix
gcc version 4.9.1 (GCC)

Reply via email to