gcc-latest: Added a patch for immutable structs

This commit is contained in:
Eugen Wissner 2023-03-22 10:58:37 +01:00
parent 6b634b4055
commit c7a527e010
Signed by: belka
GPG Key ID: A27FDC1E8EE902C0
4 changed files with 104 additions and 9 deletions

View File

@ -43,11 +43,11 @@ module SlackBuilder
checksum checksum
end end
def hosted_sources(absolute_url) def self.hosted_sources(absolute_url)
CONFIG[:download_url] + absolute_url CONFIG[:download_url] + absolute_url
end end
def remote_file_exists?(url) def self.remote_file_exists?(url)
uri = URI hosted_sources(url) uri = URI hosted_sources(url)
request = Net::HTTP.new uri.host, uri.port request = Net::HTTP.new uri.host, uri.port
@ -60,7 +60,7 @@ module SlackBuilder
def self.download_and_deploy(uri, tarball) def self.download_and_deploy(uri, tarball)
remote_path = tarball[tarball.index('/')..] remote_path = tarball[tarball.index('/')..]
if SlackBuilder.remote_file_exists?(remote_path) if remote_file_exists?(remote_path)
uri = URI hosted_sources(remote_path) uri = URI hosted_sources(remote_path)
return download(uri, "slackbuilds/#{tarball}").hexdigest return download(uri, "slackbuilds/#{tarball}").hexdigest
end end

View File

@ -30,7 +30,7 @@ cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=gcc-latest PRGNAM=gcc-latest
VERSION=${VERSION:-12.2.0} VERSION=${VERSION:-12.2.0}
BUILD=${BUILD:-1} BUILD=${BUILD:-2}
TAG=${TAG:-_SBo} TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz} PKGTYPE=${PKGTYPE:-tgz}
@ -108,6 +108,7 @@ find -L . \
# Smite the fixincludes: # Smite the fixincludes:
patch -p1 --verbose -i $CWD/patches/gcc-no_fixincludes.diff patch -p1 --verbose -i $CWD/patches/gcc-no_fixincludes.diff
patch -p1 --verbose -i $CWD/patches/gdc-immutable-struct.patch
mkdir ../objdir mkdir ../objdir
cd ../objdir cd ../objdir
@ -124,7 +125,7 @@ fi
--mandir=/usr/man \ --mandir=/usr/man \
--infodir=/usr/info \ --infodir=/usr/info \
--enable-shared \ --enable-shared \
--disable-bootstrap \ --enable-bootstrap \
--enable-languages=c,c++,d \ --enable-languages=c,c++,d \
--enable-threads=posix \ --enable-threads=posix \
--enable-checking=release \ --enable-checking=release \
@ -141,11 +142,14 @@ fi
--disable-install-libiberty \ --disable-install-libiberty \
--disable-werror \ --disable-werror \
--with-gcc-major-version-only \ --with-gcc-major-version-only \
--with-gnu-ld \
--with-isl \ --with-isl \
--program-suffix=-12 \ --program-suffix=-12 \
--enable-version-specific-runtime-libs \
--with-arch-directory=$LIB_ARCH \ --with-arch-directory=$LIB_ARCH \
--disable-gtktest \ --disable-gtktest \
--enable-clocale=gnu \ --enable-clocale=gnu \
--enable-libphobos \
$GCC_ARCHOPTS \ $GCC_ARCHOPTS \
--target=${TARGET} \ --target=${TARGET} \
--build=${TARGET} \ --build=${TARGET} \
@ -156,13 +160,12 @@ make install-strip DESTDIR=$PKG
rm $PKG/usr/lib${LIBDIRSUFFIX}/*.la rm $PKG/usr/lib${LIBDIRSUFFIX}/*.la
mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}/gcc-12
mkdir -p $PKG/usr/share/gdb/auto-load/usr/lib$LIBDIRSUFFIX mkdir -p $PKG/usr/share/gdb/auto-load/usr/lib$LIBDIRSUFFIX
mv $PKG/usr/lib$LIBDIRSUFFIX/*-gdb.py \ mv $PKG/usr/lib$LIBDIRSUFFIX/gcc/$TARGET/12/*-gdb.py \
$PKG/usr/share/gdb/auto-load/usr/lib$LIBDIRSUFFIX/ $PKG/usr/share/gdb/auto-load/usr/lib$LIBDIRSUFFIX/
mv $PKG/usr/lib${LIBDIRSUFFIX}/*.{a,o,spec,so*} \ mv $PKG/usr/lib${LIBDIRSUFFIX}/*.so* \
$PKG/usr/lib${LIBDIRSUFFIX}/gcc-12 $PKG/usr/lib$LIBDIRSUFFIX/gcc/$TARGET/12/
cd ../gcc-$VERSION cd ../gcc-$VERSION

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

@ -1,3 +1,4 @@
#!/bin/sh #!/bin/sh
bundle install bundle install
bundle exec rubocop