[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1019011: -mbuild-constants is broken in gcc-12.2



Package: gcc-12-alpha-linux-gnu
Version: 12.2.0-1cross3
Severity: normal

Starting this version of gcc, -mbuild-constants option causes it to produce
an ICE. Example is below.  This is an old code, always worked before, in
particular with gcc-11.

Removing -mbuild-constants fixes the ICE.  But this is a bios/firmware code,
and this option is used for purpose.  Tho I don't know how important it
really is.

I tried to submit this bug upstream, but failed at the bugzilla registration
step.

// Target: alpha-linux-gnu
// Configured with: ../src/configure -v --with-pkgversion='Debian 12.2.0-1' --with-bugurl=file:///usr/share/doc/gcc-12/README.Bugs --enable-languages=c,ada,c++,go,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-12 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libssp --disable-libsanitizer --disable-libquadmath --disable-libquadmath-support --enable-plugin --with-system-zlib --enable-multiarch --disable-werror --with-long-double-128 --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=alpha-linux-gnu --program-prefix=alpha-linux-gnu- --includedir=/usr/alpha-linux-gnu/include
// Thread model: posix
// Supported LTO compression algorithms: zlib zstd
// gcc version 12.2.0 (Debian 12.2.0-1) 
// 
// during RTL pass: expand
// console.c: In function ‘do_console’:
// console.c:130:12: internal compiler error: in emit_move_insn, at expr.cc:4010
//   130 |     vga[0] = 'H' + attr;
//       |     ~~~~~~~^~~~~~~~~~~~
// 0x13117e6 internal_error(char const*, ...)
// 	???:0
// 0x5a6f34 fancy_abort(char const*, int, char const*)
// 	???:0
// 0xdca64a alpha_split_const_mov(machine_mode, rtx_def**)
// 	???:0
// 0xdca7b1 alpha_expand_mov(machine_mode, rtx_def**)
// 	???:0
// 0x10d7ea9 gen_movv4hi(rtx_def*, rtx_def*)
// 	???:0
// 0x7dcd97 emit_move_insn_1(rtx_def*, rtx_def*)
// 	???:0
// 0x7dd15f emit_move_insn(rtx_def*, rtx_def*)
// 	???:0
// 0xdccec6 alpha_expand_movmisalign(machine_mode, rtx_def**)
// 	???:0
// 0x10d80e6 gen_movmisalignv4hi(rtx_def*, rtx_def*)
// 	???:0
// 0xa053f8 expand_insn(insn_code, unsigned int, expand_operand*)
// 	???:0
// Please submit a full bug report, with preprocessed source.
// Please include the complete backtrace with any bug report.
// See <file:///usr/share/doc/gcc-12/README.Bugs> for instructions.

// /usr/lib/gcc-cross/alpha-linux-gnu/12/cc1 -quiet -imultilib . -imultiarch alpha-linux-gnu -D SYSTEM_H="sys-clipper.h" console.c -quiet -dumpbase console.c -dumpbase-ext .c -msmall-text -msmall-data -mno-fp-regs -mbuild-constants -mcpu=ev67 -g1 -O2 -Wall -fdiagnostics-color=always -fvisibility=hidden -fno-strict-aliasing -freport-bug -o - -frandom-seed=0 -fdump-noaddr

# 0 "console.c"
# 1 "/build/pkg/qemu-7.1+dfsg/b/qemu-palcode//"
# 0 "<built-in>"
# 0 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 0 "<command-line>" 2
# 1 "console.c"
# 21 "console.c"
# 1 "protos.h" 1
# 27 "protos.h"
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
typedef unsigned long uint64_t;
typedef unsigned long size_t;







typedef __builtin_va_list va_list;






extern void *memset(void *, int, size_t);
extern void *memcpy(void *, const void *, size_t);
extern size_t strlen(const char *);





static inline void wrent(void *cb, unsigned long which)
{
  register void *a0 __asm__("$16") = cb;
  register unsigned long a1 __asm__("$17") = which;

  asm volatile ("call_pal 0x34"
  : "+r"(a0), "+r"(a1)
  : : "$1", "$22", "$23", "$24", "$25");
}

static inline unsigned long swpipl(unsigned long newipl)
{
  register unsigned long v0 __asm__("$0");
  register unsigned long a0 __asm__("$16") = newipl;

  asm volatile ("call_pal 0x35"
  : "=r"(v0), "+r"(a0)
  : : "$1", "$22", "$23", "$24", "$25");

  return v0;
}

static inline unsigned long rdps(void)
{
  register unsigned long v0 __asm__("$0");

  asm volatile ("call_pal 0x36"
  : "=r"(v0) : : "$1", "$22", "$23", "$24", "$25");

  return v0;
}

static inline void wrkgp(void)
{
  asm volatile ("mov $29, $16\n\tcall_pal 0x37"
  : : : "$16", "$1", "$22", "$23", "$24", "$25");
}

static inline unsigned long wtint(unsigned long skip)
{
  register unsigned long v0 __asm__("$0");
  register unsigned long a0 __asm__("$16") = skip;

  asm volatile ("call_pal 0x3e"
  : "=r"(v0), "+r"(a0)
  : : "$1", "$22", "$23", "$24", "$25");

  return v0;
}





static inline unsigned long ldq_p(unsigned long addr)
{
  register unsigned long v0 __asm__("$0");
  register unsigned long a0 __asm__("$16") = 1;
  register unsigned long a1 __asm__("$17") = addr;

  asm volatile ("call_pal 9"
  : "=r"(v0), "+r"(a0), "+r"(a1) :
  : "$18", "$19", "$20", "$21");

  return v0;
}

static inline unsigned long stq_p(unsigned long port, unsigned long val)
{
  register unsigned long v0 __asm__("$0");
  register unsigned long a0 __asm__("$16") = 2;
  register unsigned long a1 __asm__("$17") = port;
  register unsigned long a2 __asm__("$18") = val;

  asm volatile ("call_pal 9"
  : "=r"(v0), "+r"(a0), "+r"(a1), "+r"(a2) :
  : "$19", "$20", "$21");

  return v0;
}

static inline unsigned long get_wall_time(void)
{
  register unsigned long v0 __asm__("$0");
  register unsigned long a0 __asm__("$16") = 3;

  asm("call_pal 9" : "=r"(v0), "+r"(a0) : : "$17", "$18", "$19", "$20", "$21");

  return v0;
}

static inline unsigned long get_alarm(void)
{
  register unsigned long v0 __asm__("$0");
  register unsigned long a0 __asm__("$16") = 4;

  asm("call_pal 9" : "=r"(v0), "+r"(a0) : : "$17", "$18", "$19", "$20", "$21");

  return v0;
}

static inline void set_alarm_rel(unsigned long nsec)
{
  register unsigned long a0 __asm__("$16") = 5;
  register unsigned long a1 __asm__("$17") = nsec;

  asm volatile ("call_pal 9"
  : "+r"(a0), "+r"(a1)
  : : "$0", "$18", "$19", "$20", "$21");
}

static inline void set_alarm_abs(unsigned long nsec)
{
  register unsigned long a0 __asm__("$16") = 6;
  register unsigned long a1 __asm__("$17") = nsec;

  asm volatile ("call_pal 9"
  : "+r"(a0), "+r"(a1)
  : : "$0", "$18", "$19", "$20", "$21");
}





extern void *pci_io_base;
extern void *pci_mem_base;

static inline uint8_t inb(unsigned long port)
{
  return *(volatile uint8_t *)(pci_io_base + port);
}

static inline uint16_t inw(unsigned long port)
{
  return *(volatile uint16_t *)(pci_io_base + port);
}

static inline uint32_t inl(unsigned long port)
{
  return *(volatile uint32_t *)(pci_io_base + port);
}

static inline void outb(uint8_t val, unsigned long port)
{
  *(volatile uint8_t *)(pci_io_base + port) = val;
}

static inline void outw(uint16_t val, unsigned long port)
{
  *(volatile uint16_t *)(pci_io_base + port) = val;
}

static inline void outl(uint32_t val, unsigned long port)
{
  *(volatile uint32_t *)(pci_io_base + port) = val;
}





extern unsigned long crb_dispatch(long select, long a1, long a2,
                                  long a3, long a4);
extern unsigned long crb_fixup(unsigned long vptptr, unsigned long hwrpb);





extern _Bool have_vga;
extern unsigned int pci_vga_bus;
extern unsigned int pci_vga_dev;

extern void do_console(void);
extern void entInt(void);





extern int printf(const char *, ...);
extern void ndelay(unsigned long nsec);

static inline void udelay(unsigned long msec)
{
  ndelay(msec * 1000);
}




extern void ps2port_setup(void);
extern void pci_setup(void);
extern void vgahw_init(void);
# 22 "console.c" 2
# 1 "console.h" 1
# 44 "console.h"
extern unsigned long crb_getc(long unit);
extern unsigned long crb_process_keycode(long unit, long keycode, long again);
extern unsigned long crb_puts(long unit, const char *buf, unsigned long length);
extern unsigned long crb_reset_term(long unit);

extern unsigned long crb_open(const char *devstr, unsigned long length);
extern unsigned long crb_close(long channel);
extern unsigned long crb_read(long channel, unsigned long length,
                              char *buf, unsigned long block);
extern unsigned long crb_write(long channel, unsigned long length,
                               const char *buf, unsigned long block);

extern unsigned long crb_get_env(unsigned long id, char *buf,
                                 unsigned long length);
extern unsigned long crb_set_env(unsigned long id, const char *buf,
                                 unsigned long length);
# 23 "console.c" 2
# 1 "vgatables.h" 1
# 13 "vgatables.h"
typedef uint8_t u8;
typedef uint16_t u16;
# 84 "vgatables.h"
struct __attribute__((packed)) VideoParam_s {
    u8 twidth;
    u8 theightm1;
    u8 cheight;
    u16 slength;
    u8 sequ_regs[4];
    u8 miscreg;
    u8 crtc_regs[25];
    u8 actl_regs[20];
    u8 grdc_regs[9];
};

struct vgamode_s {
    u8 svgamode;
    struct VideoParam_s *vparam;
    u8 memmodel;
    u8 pixbits;
    u16 sstart;
    u8 pelmask;
    u8 *dac;
    u16 dacsize;
};

struct saveVideoHardware {
    u8 sequ_index;
    u8 crtc_index;
    u8 grdc_index;
    u8 actl_index;
    u8 feature;
    u8 sequ_regs[4];
    u8 sequ0;
    u8 crtc_regs[25];
    u8 actl_regs[20];
    u8 grdc_regs[9];
    u16 crtc_addr;
    u8 plane_latch[4];
};

struct saveBDAstate {
    u8 video_mode;
    u16 video_cols;
    u16 video_pagesize;
    u16 crtc_address;
    u8 video_rows;
    u16 char_height;
    u8 video_ctl;
    u8 video_switches;
    u8 modeset_ctl;
    u16 cursor_type;
    u16 cursor_pos[8];
    u16 video_pagestart;
    u8 video_page;





};

struct saveDACcolors {
    u8 rwmode;
    u8 peladdr;
    u8 pelmask;
    u8 dac[768];
    u8 color_select;
};


struct vgamode_s *find_vga_entry(u8 mode);
extern u16 video_save_pointer_table[];
extern struct VideoParam_s video_param_table[];
extern u8 static_functionality[];


extern const u8 vgafont8[];
extern const u8 vgafont14[];
extern const u8 vgafont16[];
extern const u8 vgafont14alt[];
extern const u8 vgafont16alt[];


struct carattr {
    u8 car, attr, use_attr;
};
struct cursorpos {
    u8 x, y, page;
};


void clear_screen(struct vgamode_s *vmode_g);
void vgafb_scroll(int nblines, int attr
                  , struct cursorpos ul, struct cursorpos lr);
void vgafb_write_char(struct cursorpos cp, struct carattr ca);
struct carattr vgafb_read_char(struct cursorpos cp);
void vgafb_write_pixel(u8 color, u16 x, u16 y);
u8 vgafb_read_pixel(u16 x, u16 y);
void vgafb_load_font(u16 seg, void *src_far, u16 count
                     , u16 start, u8 destflags, u8 fontsize);


void vgahw_screen_disable(void);
void vgahw_screen_enable(void);
void vgahw_set_border_color(u8 color);
void vgahw_set_overscan_border_color(u8 color);
u8 vgahw_get_overscan_border_color(void);
void vgahw_set_palette(u8 palid);
void vgahw_set_single_palette_reg(u8 reg, u8 val);
u8 vgahw_get_single_palette_reg(u8 reg);
void vgahw_set_all_palette_reg(u8 *data);
void vgahw_get_all_palette_reg(u8 *data);
void vgahw_toggle_intensity(u8 flag);
void vgahw_select_video_dac_color_page(u8 flag, u8 data);
void vgahw_read_video_dac_state(u8 *pmode, u8 *curpage);
void vgahw_set_dac_regs(u8 *data, u8 start, int count);
void vgahw_get_dac_regs(u8 *data, u8 start, int count);
void vgahw_set_pel_mask(u8 val);
u8 vgahw_get_pel_mask(void);
void vgahw_save_dac_state(struct saveDACcolors *info);
void vgahw_restore_dac_state(struct saveDACcolors *info);
void vgahw_sequ_write(u8 index, u8 value);
void vgahw_grdc_write(u8 index, u8 value);
void vgahw_set_text_block_specifier(u8 spec);
void get_font_access(void);
void release_font_access(void);
void vgahw_set_cursor_shape(u8 start, u8 end);
void vgahw_set_active_page(u16 address);
void vgahw_set_cursor_pos(u16 address);
void vgahw_set_scan_lines(u8 lines);
u16 vgahw_get_vde(void);
void vgahw_save_state(struct saveVideoHardware *info);
void vgahw_restore_state(struct saveVideoHardware *info);
void vgahw_set_mode(struct VideoParam_s *vparam_g);
void vgahw_enable_video_addressing(u8 disable);
void vgahw_init(void);


void cirrus_set_video_mode(u8 mode);
void cirrus_init(void);
# 24 "console.c" 2


static void
output_crnl(void)
{
  crb_puts(0, "\r\n", 2);
}

static void
output_bell(void)
{
  crb_puts(0, "\a", 1);
}

static void
backspace_and_erase(void)
{
  crb_puts(0, "\b \b", 3);
}

static unsigned long
getline(char *buf, unsigned long bufsize)
{
  unsigned long len = 0;
  long c;

  while (1)
    {
      c = crb_getc(0);
      if (c < 0)
 continue;
      switch ((int)c)
 {
 case '\r':
 case '\n':
   output_crnl();
   buf[len] = 0;
   return len;

        case '\b':
 case 0x7f:
          if (len > 0)
     {
       backspace_and_erase();
              len--;
            }
   else
     output_bell();
          break;

        default:
   if (len + 1 < bufsize)
     {
       buf[len] = c;
              crb_puts(0, buf+len, 1);
       len++;
     }
   else
     output_bell();
   break;
        }
    }
}

static inline void set_console_alarm(void)
{

  set_alarm_rel(10 * 1000 * 1000);
}

void
do_entInt(unsigned long type, unsigned long vector)
{
  switch (type)
    {
    case 0:


      break;
    case 1:

      set_console_alarm();
      break;
    case 2:


      break;
    }
}

void
do_console(void)
{
  char line[256];
  unsigned long len;

  wrkgp();
  wrent(entInt, 0);
  set_console_alarm();
  swpipl(0);

  if (have_vga)
  {
    unsigned short *vga, attr;
    vga = pci_mem_base + 0xB800 *16;
    attr = 0x2000;
    vga[0] = 'H' + attr;
    vga[1] = 'e' + attr;
    vga[2] = 'l' + attr;
    vga[3] = 'l' + attr;
    vga[4] = 'o' + attr;
  }

  while (1)
    {
      crb_puts(0, ">>> ", 4);
      len = getline(line, sizeof(line));
      crb_puts(0, "got: ", 5);
      crb_puts(0, line, len);
      output_crnl();
    }
}

Reply to: