Bug 107691 - [12 Regression] libcpp configure fails on empty expansion
Summary: [12 Regression] libcpp configure fails on empty expansion
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: preprocessor (show other bugs)
Version: 13.0
: P3 normal
Target Milestone: 12.5
Assignee: Not yet assigned to anyone
URL: https://gcc.gnu.org/pipermail/gcc-pat...
Keywords: build
Depends on:
Blocks:
 
Reported: 2022-11-14 20:17 UTC by rep.dot.nop@gmail.com
Modified: 2024-07-19 13:18 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work: 6.1.0
Known to fail: 7.1.0
Last reconfirmed: 2022-11-14 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description rep.dot.nop@gmail.com 2022-11-14 20:17:48 UTC
New debian install, /bin/sh points to dash

/scratch/src/gcc-13.orig/libcpp/configure: line 7847: test: =: unary operator expected

line 7847 reads
  if (test $have_valgrind_h = no \

Why those superfluous braces? Removing them fixes the shell script.
Comment 1 Andrew Pinski 2022-11-14 20:22:47 UTC
GCC 7 had the patch.

r7-912-gceb17928e5d1d5 introduced the bad code into configure.ac.

Confirmed.
Comment 2 Andreas Schwab 2022-11-14 20:45:09 UTC
That's 100% POSIX conforming, it's just $have_valgrind_h etc. expanding to nothing (only gcc/configure has the necessary checks).
Comment 3 Andrew Pinski 2022-11-14 20:56:15 UTC
have_valgrind_h is never set anywhere.
Adding before that code in configure.ac:
dnl # This check AC_REQUIREs various stuff, so it *must not* be inside
dnl # an if statement.  This was the source of very frustrating bugs
dnl # in converting to autoconf 2.5x!
AC_CHECK_HEADER(valgrind.h, have_valgrind_h=yes, have_valgrind_h=no)

Should fix the issue I think.
Comment 4 rep.dot.nop@gmail.com 2022-11-14 21:02:25 UTC
The problem was encountered with configure --enable-valgrind-annotations with valgrind not installed.
Comment 5 GCC Commits 2022-11-19 11:20:03 UTC
The master branch has been updated by Bernhard Reutner-Fischer <aldot@gcc.gnu.org>:

https://gcc.gnu.org/g:5a6c698ea31f587151a2fa4a982c8cc43bd9cc45

commit r13-4165-g5a6c698ea31f587151a2fa4a982c8cc43bd9cc45
Author: Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
Date:   Thu Nov 17 21:40:53 2022 +0100

    libcpp: Add missing config for --enable-valgrind-annotations [PR107691]
    
    r7-912 copied (parts of) the valgrind annotation checks from gcc
    to libcpp. The above copies the missing pieces to libcpp to diagnose
    when libcpp is configured with --enable-valgrind-annotations but
    valgrind is not installed.
    
    libcpp/ChangeLog:
    
            PR preprocessor/107691
            * configure.ac: Add valgrind header checks.
            * configure: Regenerate.
Comment 6 Jakub Jelinek 2022-11-22 11:40:47 UTC
Fixed on the trunk.
Comment 7 Richard Biener 2023-07-07 10:44:22 UTC
GCC 10 branch is being closed.
Comment 8 Richard Biener 2024-07-19 13:18:30 UTC
GCC 11 branch is being closed.