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

            Bug ID: 117854
           Summary: gcc/config/nvptx/gen-opt.sh contains a bashism,
                    causing build failure with /bin/sh as dash
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Keywords: build
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sjames at gcc dot gnu.org
  Target Milestone: ---

With /bin/sh as dash:
```
# /bin/sh
/var/tmp/portage/cross-nvptx-none/gcc-14.2.1_p20241116/work/gcc-14-20241116/gcc/config/nvptx/gen-opt.sh
"/var/tmp/portage/cross-nvptx-none/gcc-14.2.1_p20241116/work/gcc-14-20241116/gcc/config/nvptx"
; -*- buffer-read-only: t -*-
; Generated automatically by gen-opt.sh from nvptx-sm.def.

Unknown style:
"/var/tmp/portage/cross-nvptx-none/gcc-14.2.1_p20241116/work/gcc-14-20241116/gcc/config/nvptx"
```

With bash:
```
# bash
/var/tmp/portage/cross-nvptx-none/gcc-14.2.1_p20241116/work/gcc-14-20241116/gcc/config/nvptx/gen-opt.sh
"/var/tmp/portage/cross-nvptx-none/gcc-14.2.1_p20241116/work/gcc-14-20241116/gcc/config/nvptx"
; -*- buffer-read-only: t -*-
; Generated automatically by gen-opt.sh from nvptx-sm.def.

; Copyright (C) 2022-2024 Free Software Foundation, Inc.
;
; This file is part of GCC.
;
; GCC is free software; you can redistribute it and/or modify it under
; the terms of the GNU General Public License as published by the Free
; Software Foundation; either version 3, or (at your option) any later
; version.
;
; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
; WARRANTY; without even the implied warranty of MERCHANTABILITY or
; FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
; for more details.
;
; You should have received a copy of the GNU General Public License
; along with GCC; see the file COPYING3.  If not see
; <http://www.gnu.org/licenses/>.

Enum
Name(ptx_isa) Type(int)
Known PTX ISA target architectures (for use with the -misa= option):

EnumValue
Enum(ptx_isa) String(sm_30) Value(PTX_ISA_SM30)

EnumValue
Enum(ptx_isa) String(sm_35) Value(PTX_ISA_SM35)

EnumValue
Enum(ptx_isa) String(sm_53) Value(PTX_ISA_SM53)

EnumValue
Enum(ptx_isa) String(sm_70) Value(PTX_ISA_SM70)

EnumValue
Enum(ptx_isa) String(sm_75) Value(PTX_ISA_SM75)

EnumValue
Enum(ptx_isa) String(sm_80) Value(PTX_ISA_SM80)
```

The issue is non-portable use of `.` with an argument:
```
# checkbashisms
/var/tmp/portage/cross-nvptx-none/gcc-14.2.1_p20241116/work/gcc-14-20241116/gcc/config/nvptx/gen-opt.sh
possible bashism in
/var/tmp/portage/cross-nvptx-none/gcc-14.2.1_p20241116/work/gcc-14-20241116/gcc/config/nvptx/gen-opt.sh
line 39 (sourced script with arguments):
. $gen_copyright_sh opt
```

Please either change the script to have a bash shebang or fix the bashism.

Reply via email to