NetBSD Problem Report #55405

From mlelstv@hoppa.1st.de  Mon Jun 22 12:08:30 2020
Return-Path: <mlelstv@hoppa.1st.de>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id ECA281A9217
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 22 Jun 2020 12:08:29 +0000 (UTC)
Message-Id: <20200622120759.647A1B1@hoppa.1st.de>
Date: Mon, 22 Jun 2020 14:07:59 +0200 (CEST)
From: mlelstv@serpens.de
Reply-To: mlelstv@serpens.de
To: gnats-bugs@NetBSD.org
Subject: building lang/mercury loops in conftest
X-Send-Pr-Version: 3.95

>Number:         55405
>Category:       pkg
>Synopsis:       building lang/mercury loops in conftest
>Confidential:   no
>Severity:       critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jun 22 12:10:00 +0000 2020
>Originator:     Michael van Elst
>Release:        NetBSD 9.0_STABLE
>Organization:
-- 
                                Michael van Elst
Internet: mlelstv@serpens.de
                                "A potential Snark may lurk in every tree."
>Environment:


System: NetBSD victory.netbsd.org 9.0_STABLE NetBSD 9.0_STABLE (GENERIC64) #0: Tue Mar 3 18:56:34 UTC 2020 mkrepro@mkrepro.NetBSD.or
g:/usr/src/sys/arch/evbarm/compile/GENERIC64 evbarm
Architecture: aarch64
Machine: evbarm
>Description:

Building lang/mercury hangs because it runs a test program as part
of configure that loops infinitely.

This is the test program. When compiled without options, the program
exits. But when compiled with -O it hangs on aarch64 and arm. On
amd64 it segfaults instead. This happens with various NetBSD and
gcc version.

----------------------------- snip -------------------------------
/* confdefs.h */
#define PACKAGE_NAME ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define PACKAGE_STRING ""
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""
#define MR_FULLARCH "aarch64--netbsd"
#define MR_VERSION "14.01.1"
#define MR_MKFIFO "/usr/bin/mkfifo"
#define MR_HOSTNAMECMD "/bin/hostname -f"
#define MR_HAVE_SYSCONF 1
#define MR_HAVE_GETPAGESIZE 1
#define MR_HAVE_GETHOSTNAME 1
#define MR_HAVE_MMAP 1
#define MR_HAVE_MPROTECT 1
#define MR_HAVE_POSIX_MEMALIGN 1
#define MR_HAVE_SBRK 1
#define MR_HAVE_MEMMOVE 1
#define MR_HAVE_SIGACTION 1
#define MR_HAVE_SIGINTERRUPT 1
#define MR_HAVE_SETITIMER 1
#define MR_HAVE_SNPRINTF 1
#define MR_HAVE__SNPRINTF 1
#define MR_HAVE_VSNPRINTF 1
#define MR_HAVE__VSNPRINTF 1
#define MR_HAVE_STRERROR 1
#define MR_HAVE_STRERROR_R 1
#define MR_HAVE_OPEN 1
#define MR_HAVE_CLOSE 1
#define MR_HAVE_DUP 1
#define MR_HAVE_DUP2 1
#define MR_HAVE_FDOPEN 1
#define MR_HAVE_FILENO 1
#define MR_HAVE_FSTAT 1
#define MR_HAVE_STAT 1
#define MR_HAVE_LSTAT 1
#define MR_HAVE_ISATTY 1
#define MR_HAVE_GETPID 1
#define MR_HAVE_SETPGID 1
#define MR_HAVE_FORK 1
#define MR_HAVE_EXECLP 1
#define MR_HAVE_WAIT 1
#define MR_HAVE_KILL 1
#define MR_HAVE_GRANTPT 1
#define MR_HAVE_UNLOCKPT 1
#define MR_HAVE_PTSNAME 1
#define MR_HAVE_TCGETATTR 1
#define MR_HAVE_TCSETATTR 1
#define MR_HAVE_IOCTL 1
#define MR_HAVE_ACCESS 1
#define MR_HAVE_SLEEP 1
#define MR_HAVE_OPENDIR 1
#define MR_HAVE_READDIR 1
#define MR_HAVE_CLOSEDIR 1
#define MR_HAVE_MKDIR 1
#define MR_HAVE_SYMLINK 1
#define MR_HAVE_READLINK 1
#define MR_HAVE_GETTIMEOFDAY 1
#define MR_HAVE_SETENV 1
#define MR_HAVE_PUTENV 1
#define MR_HAVE__PUTENV 1
#define MR_HAVE_POSIX_SPAWN 1
#define MR_HAVE_SCHED_YIELD 1
#define MR_HAVE_MKSTEMP 1
#define MR_HAVE_SETRLIMIT 1
#define STDC_HEADERS 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRING_H 1
#define HAVE_MEMORY_H 1
#define HAVE_STRINGS_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_STDINT_H 1
#define HAVE_UNISTD_H 1
#define MR_HAVE_UNISTD_H 1
#define MR_HAVE_SYS_WAIT_H 1
#define MR_HAVE_SYS_SIGINFO_H 1
#define MR_HAVE_SYS_SIGNAL_H 1
#define MR_HAVE_UCONTEXT_H 1
#define MR_HAVE_SYS_PARAM_H 1
#define MR_HAVE_SYS_TIME_H 1
#define MR_HAVE_SYS_TIMES_H 1
#define MR_HAVE_SYS_TYPES_H 1
#define MR_HAVE_SYS_STAT_H 1
#define MR_HAVE_FCNTL_H 1
#define MR_HAVE_TERMIOS_H 1
#define MR_HAVE_SYS_IOCTL_H 1
#define MR_HAVE_SYS_RESOURCE_H 1
#define MR_HAVE_DIRENT_H 1
#define MR_HAVE_GETOPT_H 1
#define MR_HAVE_MALLOC_H 1
#define MR_HAVE_SEMAPHORE_H 1
#define MR_HAVE_PTHREAD_H 1
#define MR_HAVE_TIME_H 1
#define MR_HAVE_SPAWN_H 1
#define MR_HAVE_FENV_H 1
#define MR_HAVE_SYS_MMAN_H 1
#define MR_HAVE_SYS_SEM_H 1
#define MR_HAVE_SCHED_H 1
#define MR_HAVE_UTMPX_H 1
#define MR_HAVE_FESETROUND 1
#define MR_SIGACTION_FIELD sa_sigaction
#define MR_HAVE_SIGINFO 1
#define MR_HAVE_SIGINFO_T 1
#define MR_HAVE_SIGINFO 1
#define MR_WORD_TYPE long
#define MR_INTEGER_LENGTH_MODIFIER "l"
#define MR_INT_LEAST64_TYPE long
#define MR_INT_LEAST64_LENGTH_MODIFIER "l"
#define MR_INT_LEAST32_TYPE int
#define MR_INT_LEAST32_MAX INT_MAX
#define MR_UINT_LEAST32_MAX UINT_MAX
#define HAVE_DEV_T 1
#define HAVE_INO_T 1
#define MR_HAVE_DEV_T 1
#define MR_HAVE_INO_T 1
#define MR_INT_LEAST16_TYPE short
#define MR_INT_LEAST16_MAX SHRT_MAX
#define MR_UINT_LEAST16_MAX USHRT_MAX
#define MR_LOW_TAG_BITS 3
#define MR_BYTES_PER_WORD 8
#define MR_BITS_PER_WORD 64
#define MR_DOUBLE_IS_64_BIT 1
#define MR_SYNC_TERM_SIZE 3
#define MR_LITTLE_ENDIAN 1
#define MR_HAVE_OCREAT_OEXCL 1
#define MR_CAN_DO_PENDING_IO 1
/* end confdefs.h.  */

    extern void     exit(int);
    void            *entry_foo_1;
    void            *entry_bar_1;
    void            *succip;
    int             global;
    void            *dummy_identity_function(void *);

    foo() {
        entry_foo_1 = && foo_1;
        goto *dummy_identity_function(&&return_label);
    return_label:
        return;
    foo_1:
        __asm__ __volatile__("":::"memory");
        if (global != 42) exit(1);
        goto *entry_bar_1;
    }
    bar() {
        entry_bar_1 = && bar_1;
        goto *dummy_identity_function(&&return_label);
    return_label:
        return;
    bar_1:
        __asm__ __volatile__("":::"memory");
        if (global != 42) exit(1);
        goto *succip;
    }
    main() {
        global = 42;
        foo();
        bar();
        succip = &&last;
        goto *dummy_identity_function(&&return_label);
    return_label:
        goto *entry_foo_1;
        exit(1);
    last:
        __asm__ __volatile__("":::"memory");
        if (global != 42) exit(1);
        exit(0);
    }
    void *dummy_identity_function(void *p) {
        return p;
    }
----------------------------- snap -------------------------------

On amd64 the package builds besides crashing the test program.

If the test program is killed on aarch64, the build fails later
in the embedded boehm-gc code. This might be a consequence of the
configure test, but is more likely a separate problem.

>How-To-Repeat:

build lang/mercury on aarch64.

>Fix:


>Unformatted:

NetBSD Home
NetBSD PR Database Search

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