NetBSD Problem Report #55265

From  Thu May 14 22:05:44 2020
Return-Path: <>
Received: from ( [])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "", Issuer " CA" (not verified))
	by (Postfix) with ESMTPS id E282A1A9213
	for <>; Thu, 14 May 2020 22:05:44 +0000 (UTC)
Message-Id: <>
Date: Fri, 15 May 2020 07:05:35 +0900 (JST)
From: Izumi Tsutsui <>
Subject: NetBSD/sh3el 9.0 gcc 7.4.0 ICE by -fdce
X-Send-Pr-Version: 3.95

>Number:         55265
>Category:       toolchain
>Synopsis:       NetBSD/sh3el 9.0 gcc 7.4.0 ICE by -fdce
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu May 14 22:10:00 +0000 2020
>Last-Modified:  Sun Jun 21 17:55:00 +0000 2020
>Originator:     Izumi Tsutsui
>Release:        NetBSD 9.0
System: NetBSD lantank 9.0 NetBSD 9.0 (LANTANK) #1: Sun May  3 17:58:04 JST 2020  tsutsui@mirage:/s/netbsd-9/src/sys/arch/landisk/compile/LANTANK landisk
Architecture: sh3el
Machine: landisk
During pkgsrc/x11/mlterm build on NetBSD/landisk 9.0, gcc 7.4.0 gets ICE:

../../libtool --mode=compile gcc   -I../../baselib/include -I../../encodefilter/include  -I/usr/pkg/include/fribidi    -Os -freorder-blocks -D_FORTIFY_SOURCE=2 -I/usr/pkg/include -I/usr/X11R7/include -I/usr/include -I/usr/X11R7/include/freetype2 -I/usr/pkg/include/glib-2.0 -I/usr/pkg/include/gio-unix-2.0 -I/usr/pkg/lib/glib-2.0/include -DPNG_NO_ASSEMBLER_CODE -I/usr/pkg/include -I/usr/X11R7/include -I/usr/include -I/usr/X11R7/include/freetype2 -I/usr/pkg/include/glib-2.0 -I/usr/pkg/include/gio-unix-2.0 -I/usr/pkg/lib/glib-2.0/include  -I/usr/pkg/include -DLIBDIR=\"/usr/pkg/lib\" -c   -I../../baselib/include -I../../encodefilter/include  -I/usr/pkg/include/fribidi    -Os -freorder-blocks -D_FORTIFY_SOURCE=2 -I/usr/pkg/include -I/usr/X11R7/include -I/usr/include -I/usr/X11R7/include/freetype2 -I/usr/pkg/include/glib-2.0 -I/usr/pkg/include/gio-unix-2.0 -I/usr/pkg/lib/glib-2.0/include -DPNG_NO_ASSEMBLER_CODE -I/usr/pkg/include -I/usr/X11R7/include -I/usr/include -I/usr/X11R7/inc!
 lude/freetype2 -I/usr/pkg/include/glib-2.0 -I/usr/pkg/include/gio-unix-2.0 -I/usr/pkg/lib/glib-2.0/include  -I/usr/pkg/include -DLIBDIR=\"/usr/pkg/lib\" vt_line_bidi.c
libtool: compile:  gcc -I../../baselib/include -I../../encodefilter/include -I/usr/obj.sh3el/pkgsrc/x11/mlterm/work.sh3el/.buildlink/include/fribidi -Os -freorder-blocks -D_FORTIFY_SOURCE=2 -I/usr/obj.sh3el/pkgsrc/x11/mlterm/work.sh3el/.buildlink/include -I/usr/obj.sh3el/pkgsrc/x11/mlterm/work.sh3el/.x11-buildlink/include -I/usr/obj.sh3el/pkgsrc/x11/mlterm/work.sh3el/.x11-buildlink/include/freetype2 -I/usr/obj.sh3el/pkgsrc/x11/mlterm/work.sh3el/.buildlink/include/glib-2.0 -I/usr/obj.sh3el/pkgsrc/x11/mlterm/work.sh3el/.buildlink/include/gio-unix-2.0 -I/usr/obj.sh3el/pkgsrc/x11/mlterm/work.sh3el/.buildlink/lib/glib-2.0/include -DPNG_NO_ASSEMBLER_CODE -DLIBDIR=\"/usr/pkg/lib\" -c -Os -freorder-blocks -D_FORTIFY_SOURCE=2 -DPNG_NO_ASSEMBLER_CODE -DLIBDIR=\"/usr/pkg/lib\" vt_line_bidi.c  -fPIC -DPIC -o .libs/vt_line_bidi.o
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
vt_line_bidi.c: In function 'vt_line_bidi_render':
vt_line_bidi.c:144:1: internal compiler error: Abort trap
no stack trace because unwind library not available
Please submit a full bug report,
with preprocessed source if appropriate.
See <> for instructions.
*** Error code 1


This ICE also happens on cross compiler on NetBSD/i386 9.0.

A sample code to reproduce is as the following:

struct vt_bidi_state {
  char rtl_state;
typedef struct vt_bidi_state *vt_bidi_state_t;

typedef struct ctl_info {
  vt_bidi_state_t bidi;
} ctl_info_t;

typedef struct vt_line {
  ctl_info_t ctl_info;
} vt_line_t;

#define BASE_IS_RTL(state) ((((state)->rtl_state) >> 1) & 0x1)

extern int f1(void), f2(void), f3(void), f4(void);

int vt_line_bidi_render(vt_line_t *line)
  int ret;

  if (f1()) {
    int base_was_rtl;

    base_was_rtl = BASE_IS_RTL(line->ctl_info.bidi);
    if ((ret = f2()) <= 0) {
      if (base_was_rtl) {
      return ret;
    if (base_was_rtl != BASE_IS_RTL(line->ctl_info.bidi)) {
      return 1;
  if (ret == 2) {
  return 1;

On NetBSD/i386 9.0 with 9.0 toolchain:
% /s/netbsd-9/src/obj.landisk/tooldir.NetBSD-9.0-i386/bin/shle--netbsdelf-gcc -O -c ~/vt_line_bidi.c
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
/home/tsutsui/vt_line_bidi.c: In function 'vt_line_bidi_render':
/home/tsutsui/vt_line_bidi.c:40:1: internal compiler error: Abort trap
Please submit a full bug report,
with preprocessed source if appropriate.
See <> for instructions.
% /s/netbsd-9/src/obj.landisk/tooldir.NetBSD-9.0-i386/bin/shle--netbsdelf-gcc -O -fno-dce -c ~/vt_line_bidi.c

Also available on github gist:

No idea.
"-fno-dce" works around on pkgsrc mlterm build as above.

Izumi Tsutsui

From: "Izumi Tsutsui" <>
Subject: PR/55265 CVS commit: pkgsrc/x11/mlterm
Date: Sun, 21 Jun 2020 17:53:01 +0000

 Module Name:	pkgsrc
 Committed By:	tsutsui
 Date:		Sun Jun 21 17:53:01 UTC 2020

 Modified Files:
 	pkgsrc/x11/mlterm: Makefile distinfo
 	pkgsrc/x11/mlterm/patches: patch-etc_font-fb
 Added Files:
 	pkgsrc/x11/mlterm/patches: patch-uitoolkit_xlib_ui__imagelib.c

 Log Message:
 mlterm: pull an upstream patch for 3.9.0.

 Also put misc pkgsrc tweaks:
 - Disable SPECIAL_PERMS for mlterm.  It was required for utmp support
   only on ancient systems that have none of pututxline(3), setutent(3),
   or addToUtmp(3) but have to use logwtmp(3) or open system's _PATH_UTMP
   or _PATH_WTMP file directly to update utmp entries, but no easy way
   to statically identify them per OS and version basis.
 - Add to avoid gcc SIGSEGV on NetBSD/sh3 9.0 (PR/55265)
 - Appease several pkglint warnings/errors.


 To generate a diff of this commit:
 cvs rdiff -u -r1.160 -r1.161 pkgsrc/x11/mlterm/Makefile
 cvs rdiff -u -r1.84 -r1.85 pkgsrc/x11/mlterm/distinfo
 cvs rdiff -u -r0 -r1.1 pkgsrc/x11/mlterm/
 cvs rdiff -u -r1.19 -r1.20 pkgsrc/x11/mlterm/
 cvs rdiff -u -r1.9 -r1.10 pkgsrc/x11/mlterm/patches/patch-etc_font-fb
 cvs rdiff -u -r0 -r1.1 \

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD:,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.