Compare commits

..

No commits in common. "6f5eaf9650e9e23b11f81366de580215ddf57295" and "79bdca04e2cc9e13bbfa1cac7619d5e4a56ff0bd" have entirely different histories.

8 changed files with 545 additions and 13 deletions

View File

@ -2,34 +2,34 @@ GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
ast (2.4.2) ast (2.4.2)
json (2.6.3) json (2.6.2)
parallel (1.23.0) parallel (1.22.1)
parser (3.2.2.0) parser (3.1.2.1)
ast (~> 2.4.1) ast (~> 2.4.1)
progressbar (1.13.0) progressbar (1.11.0)
rainbow (3.1.1) rainbow (3.1.1)
rake (13.0.6) rake (13.0.6)
regexp_parser (2.8.0) regexp_parser (2.6.0)
rexml (3.2.5) rexml (3.2.5)
rubocop (1.50.2) rubocop (1.38.0)
json (~> 2.3) json (~> 2.3)
parallel (~> 1.10) parallel (~> 1.10)
parser (>= 3.2.0.0) parser (>= 3.1.2.1)
rainbow (>= 2.2.2, < 4.0) rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0) regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0) rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.28.0, < 2.0) rubocop-ast (>= 1.23.0, < 2.0)
ruby-progressbar (~> 1.7) ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0) unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.28.0) rubocop-ast (1.23.0)
parser (>= 3.2.1.0) parser (>= 3.1.1.0)
ruby-progressbar (1.13.0) ruby-progressbar (1.11.0)
sync (0.5.0) sync (0.5.0)
term-ansicolor (1.7.1) term-ansicolor (1.7.1)
tins (~> 1.0) tins (~> 1.0)
tins (1.32.1) tins (1.32.1)
sync sync
unicode-display_width (2.4.2) unicode-display_width (2.3.0)
PLATFORMS PLATFORMS
ruby ruby

View File

@ -0,0 +1,6 @@
GCC 12 with C, C++ and D support.
GCC is the GNU Compiler Collection.
D is a general-purpose programming language with static typing,
systems-level access, and C-like syntax.

View File

@ -0,0 +1,192 @@
#!/bin/bash
# GCC package build script (written by volkerdi@slackware.com)
#
# Copyright 2003, 2004 Slackware Linux, Inc., Concord, California, USA
# Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2021 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Modified 2011 by Eric Hameleers <alien at slackware.com> for OpenJDK.
# Modified 2022 by Eugen Wissner <belka@caraus.de> for gcc-latest.
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=gcc-latest
VERSION=${VERSION:-12.2.0}
BUILD=${BUILD:-3}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
case "$(uname -m)" in
i?86) ARCH=i586 ;;
arm*) readelf /usr/bin/file -A | egrep -q "Tag_CPU.*[4,5]" && ARCH=arm || ARCH=armv7hl ;;
# Unless $ARCH is already set, use uname -m for all other archs:
*) ARCH=$(uname -m) ;;
esac
export ARCH
fi
# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
# the name of the created package would be, and then exit. This information
# could be useful to other scripts.
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
exit 0
fi
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i386" ]; then
LIBDIRSUFFIX=""
LIB_ARCH=i386
elif [ "$ARCH" = "i486" ]; then
LIBDIRSUFFIX=""
LIB_ARCH=i386
elif [ "$ARCH" = "i586" ]; then
LIBDIRSUFFIX=""
LIB_ARCH=i386
elif [ "$ARCH" = "i686" ]; then
LIBDIRSUFFIX=""
LIB_ARCH=i386
elif [ "$ARCH" = "s390" ]; then
LIBDIRSUFFIX=""
LIB_ARCH=s390
elif [ "$ARCH" = "x86_64" ]; then
LIBDIRSUFFIX="64"
LIB_ARCH=amd64
elif [ "$ARCH" = "armv7hl" ]; then
LIBDIRSUFFIX=""
LIB_ARCH=armv7hl
else
LIBDIRSUFFIX=""
LIB_ARCH=$ARCH
fi
case "$ARCH" in
arm*) TARGET=$ARCH-slackware-linux-gnueabi ;;
*) TARGET=$ARCH-slackware-linux ;;
esac
set -e # Exit on most errors
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
mkdir -p $PRGNAM-$VERSION
cd $PRGNAM-$VERSION
tar xvf $CWD/gcc-$VERSION.tar.?z
cd gcc-$VERSION
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
# Smite the fixincludes:
patch -p1 --verbose -i $CWD/patches/gcc-no_fixincludes.diff
patch -p1 --verbose -i $CWD/patches/gdc-immutable-struct.patch
patch -p1 --verbose -i $CWD/patches/gdc-link-lambda.patch
mkdir ../objdir
cd ../objdir
if [ "$ARCH" != "x86_64" ]; then
GCC_ARCHOPTS="--with-arch=$ARCH"
else
GCC_ARCHOPTS="--disable-multilib"
fi
../gcc-$VERSION/configure \
--prefix=/usr \
--libdir=/usr/lib$LIBDIRSUFFIX \
--mandir=/usr/man \
--infodir=/usr/info \
--enable-shared \
--enable-bootstrap \
--enable-languages=c,c++,d \
--enable-threads=posix \
--enable-checking=release \
--with-system-zlib \
--disable-libquadmath-support \
--with-default-libstdcxx-abi=new \
--disable-libstdcxx-pch \
--disable-libunwind-exceptions \
--enable-__cxa_atexit \
--disable-libssp \
--enable-gnu-unique-object \
--enable-plugin \
--enable-lto \
--disable-install-libiberty \
--disable-werror \
--with-gcc-major-version-only \
--with-gnu-ld \
--with-isl \
--program-suffix=-12 \
--enable-version-specific-runtime-libs \
--with-arch-directory=$LIB_ARCH \
--disable-gtktest \
--enable-clocale=gnu \
--enable-libphobos \
$GCC_ARCHOPTS \
--target=${TARGET} \
--build=${TARGET} \
--host=${TARGET}
make
make install-strip DESTDIR=$PKG
rm $PKG/usr/lib${LIBDIRSUFFIX}/*.la
mkdir -p $PKG/usr/share/gdb/auto-load/usr/lib$LIBDIRSUFFIX
mv $PKG/usr/lib$LIBDIRSUFFIX/gcc/$TARGET/12/*-gdb.py \
$PKG/usr/share/gdb/auto-load/usr/lib$LIBDIRSUFFIX/
mv $PKG/usr/lib${LIBDIRSUFFIX}/*.so* \
$PKG/usr/lib$LIBDIRSUFFIX/gcc/$TARGET/12/
cd ../gcc-$VERSION
# They conflict with the stock package.
rm -rf $PKG/usr/man/man7 \
$PKG/usr/info \
$PKG/usr/share/locale
# Compress man pages
find $PKG/usr/man -type f -exec gzip -9 {} \;
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a \
COPYING* ChangeLog* INSTALL LAST_UPDATED MAINTAINERS NEWS README* \
$PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE

View File

@ -0,0 +1,10 @@
PRGNAM="gcc-latest"
VERSION="12.2.0"
HOMEPAGE="https://gcc.gnu.org/"
DOWNLOAD="https://ftp.gnu.org/gnu/gcc/gcc-12.2.0/gcc-12.2.0.tar.xz"
MD5SUM="73bafd0af874439dcdb9fc063b6fb069"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES="%README%"
MAINTAINER="Eugen Wissner"
EMAIL="belka@caraus.de"

View File

@ -0,0 +1,27 @@
--- ./gcc/Makefile.in.orig 2018-03-09 09:24:44.000000000 -0600
+++ ./gcc/Makefile.in 2018-05-02 12:25:43.958002771 -0500
@@ -3004,9 +3004,9 @@
chmod a+r $${fix_dir}/limits.h; \
done
# Install the README
- rm -f include-fixed/README
- cp $(srcdir)/../fixincludes/README-fixinc include-fixed/README
- chmod a+r include-fixed/README
+# rm -f include-fixed/README
+# cp $(srcdir)/../fixincludes/README-fixinc include-fixed/README
+# chmod a+r include-fixed/README
$(STAMP) $@
.PHONY: install-gcc-tooldir
@@ -3087,10 +3087,7 @@
(TARGET_MACHINE='$(target)'; srcdir=`cd $(srcdir); ${PWD_COMMAND}`; \
SHELL='$(SHELL)'; MACRO_LIST=`${PWD_COMMAND}`/macro_list ; \
gcc_dir=`${PWD_COMMAND}` ; \
- export TARGET_MACHINE srcdir SHELL MACRO_LIST && \
- cd $(build_objdir)/fixincludes && \
- $(SHELL) ./fixinc.sh "$${gcc_dir}/$${fix_dir}" \
- $(BUILD_SYSTEM_HEADER_DIR) $(OTHER_FIXINCLUDES_DIRS) ); \
+ export TARGET_MACHINE srcdir SHELL MACRO_LIST ); \
rm -f $${fix_dir}/syslimits.h; \
if [ -f $${fix_dir}/limits.h ]; then \
mv $${fix_dir}/limits.h $${fix_dir}/syslimits.h; \

View File

@ -0,0 +1,91 @@
From 2583365912c8700abe1f4a23ed611acb80fac09d Mon Sep 17 00:00:00 2001
From: Iain Buclaw <ibuclaw@gdcproject.org>
Date: Mon, 27 Feb 2023 20:46:18 +0100
Subject: [PATCH] d: Fix ICE on explicit immutable struct import [PR108877]
Const and immutable types are built as variants of the type they are
derived from, and TYPE_STUB_DECL is not set for these variants.
PR d/108877
gcc/d/ChangeLog:
* imports.cc (ImportVisitor::visit (EnumDeclaration *)): Call
make_import on TYPE_MAIN_VARIANT.
(ImportVisitor::visit (AggregateDeclaration *)): Likewise.
(ImportVisitor::visit (ClassDeclaration *)): Likewise.
gcc/testsuite/ChangeLog:
* gdc.dg/imports/pr108877a.d: New test.
* gdc.dg/pr108877.d: New test.
(cherry picked from commit ce1cea3e22f58bbddde017f8a92e59bae8892339)
---
gcc/d/imports.cc | 7 ++++++-
gcc/testsuite/gdc.dg/imports/pr108877a.d | 6 ++++++
gcc/testsuite/gdc.dg/pr108877.d | 9 +++++++++
3 files changed, 21 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/gdc.dg/imports/pr108877a.d
create mode 100644 gcc/testsuite/gdc.dg/pr108877.d
diff --git a/gcc/d/imports.cc b/gcc/d/imports.cc
index dfda2401ee8..6a59ef61b9c 100644
--- a/gcc/d/imports.cc
+++ b/gcc/d/imports.cc
@@ -106,12 +106,16 @@ public:
tree type = build_ctype (d->type);
/* Not all kinds of D enums create a TYPE_DECL. */
if (TREE_CODE (type) == ENUMERAL_TYPE)
- this->result_ = this->make_import (TYPE_STUB_DECL (type));
+ {
+ type = TYPE_MAIN_VARIANT (type);
+ this->result_ = this->make_import (TYPE_STUB_DECL (type));
+ }
}
void visit (AggregateDeclaration *d)
{
tree type = build_ctype (d->type);
+ type = TYPE_MAIN_VARIANT (type);
this->result_ = this->make_import (TYPE_STUB_DECL (type));
}
@@ -119,6 +123,7 @@ public:
{
/* Want the RECORD_TYPE, not POINTER_TYPE. */
tree type = TREE_TYPE (build_ctype (d->type));
+ type = TYPE_MAIN_VARIANT (type);
this->result_ = this->make_import (TYPE_STUB_DECL (type));
}
diff --git a/gcc/testsuite/gdc.dg/imports/pr108877a.d b/gcc/testsuite/gdc.dg/imports/pr108877a.d
new file mode 100644
index 00000000000..a23c78ddf84
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/imports/pr108877a.d
@@ -0,0 +1,6 @@
+immutable struct ImmutableS { }
+const struct ConstS { }
+immutable class ImmutableC { }
+const class ConstC { }
+immutable enum ImmutableE { _ }
+const enum ConstE { _ }
diff --git a/gcc/testsuite/gdc.dg/pr108877.d b/gcc/testsuite/gdc.dg/pr108877.d
new file mode 100644
index 00000000000..710551f3f9a
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/pr108877.d
@@ -0,0 +1,9 @@
+// { dg-options "-I $srcdir/gdc.dg" }
+// { dg-do compile }
+import imports.pr108877a :
+ ImmutableS,
+ ConstS,
+ ImmutableC,
+ ConstC,
+ ImmutableE,
+ ConstE;
--
2.31.1

View File

@ -0,0 +1,187 @@
From 3b8b42f32627ca5ad029fe418a5839b9fc4512e9 Mon Sep 17 00:00:00 2001
From: Iain Buclaw <ibuclaw@gdcproject.org>
Date: Sat, 10 Dec 2022 22:11:41 +0100
Subject: [PATCH] d: Fix undefined reference to nested lambda in template
(PR108055)
Sometimes, nested lambdas of templated functions get no code generation
due to them being marked as instantianted outside of all modules being
compiled in the current compilation unit. This despite enclosing
template instances being marked as instantiated inside the current
compilation unit. To fix, all enclosing templates are now checked in
`function_defined_in_root_p'.
Because of this change, `function_needs_inline_definition_p' has also
been fixed up to only check whether the regular function definition
itself is to be emitted in the current compilation unit.
PR d/108055
gcc/d/ChangeLog:
* decl.cc (function_defined_in_root_p): Check all enclosing template
instances for definition in a root module.
(function_needs_inline_definition_p): Replace call to
function_defined_in_root_p with test for outer module `isRoot'.
gcc/testsuite/ChangeLog:
* gdc.dg/torture/imports/pr108055conv.d: New.
* gdc.dg/torture/imports/pr108055spec.d: New.
* gdc.dg/torture/imports/pr108055write.d: New.
* gdc.dg/torture/pr108055.d: New test.
(cherry picked from commit 9fe7d3debbf60ed9fef8053123ad542a99d62100)
---
gcc/d/decl.cc | 14 ++++++----
.../gdc.dg/torture/imports/pr108055conv.d | 26 +++++++++++++++++++
.../gdc.dg/torture/imports/pr108055spec.d | 18 +++++++++++++
.../gdc.dg/torture/imports/pr108055write.d | 19 ++++++++++++++
gcc/testsuite/gdc.dg/torture/pr108055.d | 12 +++++++++
5 files changed, 84 insertions(+), 5 deletions(-)
create mode 100644 gcc/testsuite/gdc.dg/torture/imports/pr108055conv.d
create mode 100644 gcc/testsuite/gdc.dg/torture/imports/pr108055spec.d
create mode 100644 gcc/testsuite/gdc.dg/torture/imports/pr108055write.d
create mode 100644 gcc/testsuite/gdc.dg/torture/pr108055.d
diff --git a/gcc/d/decl.cc b/gcc/d/decl.cc
index e62be0c580a..11fd7f6c81f 100644
--- a/gcc/d/decl.cc
+++ b/gcc/d/decl.cc
@@ -1023,7 +1023,8 @@ build_decl_tree (Dsymbol *d)
input_location = saved_location;
}
-/* Returns true if function FD is defined or instantiated in a root module. */
+/* Returns true if function FD, or any lexically enclosing scope function of FD
+ is defined or instantiated in a root module. */
static bool
function_defined_in_root_p (FuncDeclaration *fd)
@@ -1032,9 +1033,11 @@ function_defined_in_root_p (FuncDeclaration *fd)
if (md && md->isRoot ())
return true;
- TemplateInstance *ti = fd->isInstantiated ();
- if (ti && ti->minst && ti->minst->isRoot ())
- return true;
+ for (TemplateInstance *ti = fd->isInstantiated (); ti != NULL; ti = ti->tinst)
+ {
+ if (ti->minst && ti->minst->isRoot ())
+ return true;
+ }
return false;
}
@@ -1062,7 +1065,8 @@ function_needs_inline_definition_p (FuncDeclaration *fd)
/* Check whether function will be regularly defined later in the current
translation unit. */
- if (function_defined_in_root_p (fd))
+ Module *md = fd->getModule ();
+ if (md && md->isRoot ())
return false;
/* Non-inlineable functions are always external. */
diff --git a/gcc/testsuite/gdc.dg/torture/imports/pr108055conv.d b/gcc/testsuite/gdc.dg/torture/imports/pr108055conv.d
new file mode 100644
index 00000000000..93ebba747b1
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/torture/imports/pr108055conv.d
@@ -0,0 +1,26 @@
+module imports.pr108055conv;
+
+T toStr(T, S)(S src)
+{
+ static if (is(typeof(T.init[0]) E))
+ {
+ struct Appender
+ {
+ inout(E)[] data;
+ }
+
+ import imports.pr108055spec;
+ import imports.pr108055write;
+
+ auto w = Appender();
+ FormatSpec!E f;
+ formatValue(w, src, f);
+ return w.data;
+ }
+}
+
+T to(T, A)(A args)
+{
+ return toStr!T(args);
+}
+
diff --git a/gcc/testsuite/gdc.dg/torture/imports/pr108055spec.d b/gcc/testsuite/gdc.dg/torture/imports/pr108055spec.d
new file mode 100644
index 00000000000..801c5810516
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/torture/imports/pr108055spec.d
@@ -0,0 +1,18 @@
+module imports.pr108055spec;
+
+template Unqual(T : const U, U)
+{
+ alias Unqual = U;
+}
+
+template FormatSpec(Char)
+if (!is(Unqual!Char == Char))
+{
+ alias FormatSpec = FormatSpec!(Unqual!Char);
+}
+
+struct FormatSpec(Char)
+if (is(Unqual!Char == Char))
+{
+ const(Char)[] nested;
+}
diff --git a/gcc/testsuite/gdc.dg/torture/imports/pr108055write.d b/gcc/testsuite/gdc.dg/torture/imports/pr108055write.d
new file mode 100644
index 00000000000..fe41d7baa7c
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/torture/imports/pr108055write.d
@@ -0,0 +1,19 @@
+module imports.pr108055write;
+import imports.pr108055spec;
+
+void formatValueImpl(Writer, T, Char)(ref Writer , const(T) ,
+ scope const ref FormatSpec!Char )
+{
+ T val;
+ char spec;
+
+ (ref val) @trusted {
+ return (cast(const char*) &val)[0 .. val.sizeof];
+ }(val);
+
+}
+
+void formatValue(Writer, T, Char)(Writer w, T val, Char f)
+{
+ formatValueImpl(w, val, f);
+}
diff --git a/gcc/testsuite/gdc.dg/torture/pr108055.d b/gcc/testsuite/gdc.dg/torture/pr108055.d
new file mode 100644
index 00000000000..c4ffad26d1e
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/torture/pr108055.d
@@ -0,0 +1,12 @@
+// { dg-do link }
+// { dg-additional-files "imports/pr108055conv.d imports/pr108055spec.d imports/pr108055write.d" }
+// { dg-additional-options "-I[srcdir] -fno-druntime" }
+import imports.pr108055conv;
+
+extern(C) int main()
+{
+ float zis;
+ static if (is(typeof(to!string(&zis))))
+ to!string(&zis);
+ return 0;
+}
--
2.31.1

View File

@ -0,0 +1,19 @@
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|' on
# the right side marks the last column you can put a character in. You must make
# exactly 11 lines for the formatting to be correct. It's also customary to
# leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
gcc-latest: gcc-latest (GCC package with C, C++ and D support)
gcc-latest:
gcc-latest: GCC is the GNU Compiler Collection.
gcc-latest:
gcc-latest: D is a general-purpose programming language with static typing,
gcc-latest: systems-level access, and C-like syntax.
gcc-latest:
gcc-latest:
gcc-latest:
gcc-latest:
gcc-latest: