apply upstream fixes to fix crashes seen in libQtScript after building Qt (seehttps://bugzilla.redhat.com/show_bug.cgi?id=1091482 ) [release 4.9.0-2mamba;Mon Jun 16 2014]

This commit is contained in:
Silvan Calarco 2024-01-05 22:37:49 +01:00
parent 52c8a529e2
commit 6b32be643f
2 changed files with 121 additions and 8 deletions

View File

@ -0,0 +1,102 @@
Submitted By: Armin K. <krejzi at email dot com>
Date: 2014-05-10
Initial Package Version: 4.9.0
Upstream Status: Fixed Upstream
Origin: Upstream VCS
Description: Prevents compiler from generating broken code that would cause
some programs to segfault or behave incorrectly when compiled
with gcc-4.9.0
--- a/gcc/ipa-devirt.c 2014-04-08 07:35:11.000000000 +0200
+++ b/gcc/ipa-devirt.c 2014-05-10 16:46:14.502859179 +0200
@@ -987,6 +987,17 @@
context->outer_type = expected_type;
context->offset = 0;
context->maybe_derived_type = true;
+ context->maybe_in_construction = true;
+ /* POD can be changed to an instance of a polymorphic type by
+ placement new. Here we play safe and assume that any
+ non-polymorphic type is POD. */
+ if ((TREE_CODE (type) != RECORD_TYPE
+ || !TYPE_BINFO (type)
+ || !polymorphic_type_binfo_p (TYPE_BINFO (type)))
+ && (TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST
+ || (offset + tree_to_uhwi (TYPE_SIZE (expected_type)) <=
+ tree_to_uhwi (TYPE_SIZE (type)))))
+ return true;
return false;
}
--- a/gcc/testsuite/g++.dg/ipa/devirt-11.C 2013-09-08 18:42:21.000000000 +0200
+++ b/gcc/testsuite/g++.dg/ipa/devirt-11.C 2014-05-10 16:46:14.503859198 +0200
@@ -45,5 +45,5 @@
/* While inlining function called once we should devirtualize a new call to fn2
and two to fn3. While doing so the new symbol for fn2 needs to be
introduced. */
-/* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a known target" 3 "inline" } } */
+/* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a known target" 1 "inline" } } */
/* { dg-final { cleanup-ipa-dump "inline" } } */
--- a/gcc/testsuite/g++.dg/ipa/devirt-31.C 1970-01-01 01:00:00.000000000 +0100
+++ b/gcc/testsuite/g++.dg/ipa/devirt-31.C 2014-05-10 16:46:14.503859198 +0200
@@ -0,0 +1,23 @@
+/* { dg-options "-O2 -std=c++11 -fdump-ipa-inline" } */
+#include <new>
+
+class EmbeddedObject {
+public:
+ virtual int val() { return 2; }
+};
+
+class Container {
+ alignas(EmbeddedObject) char buffer[sizeof(EmbeddedObject)];
+public:
+ EmbeddedObject *obj() { return (EmbeddedObject*)buffer; }
+ Container() { new (buffer) EmbeddedObject(); }
+};
+
+Container o;
+
+int main()
+{
+ __builtin_printf("%d\n", o.obj()->val());
+}
+/* { dg-final { scan-ipa-dump-not "__builtin_unreachable" "inline" } } */
+/* { dg-final { cleanup-ipa-dump "inline" } } */
--- a/gcc/tree-ssa-threadedge.c 2014-01-02 23:23:26.000000000 +0100
+++ b/gcc/tree-ssa-threadedge.c 2014-05-10 16:45:59.053571881 +0200
@@ -387,7 +387,34 @@
&& (gimple_code (stmt) != GIMPLE_CALL
|| gimple_call_lhs (stmt) == NULL_TREE
|| TREE_CODE (gimple_call_lhs (stmt)) != SSA_NAME))
- continue;
+ {
+ /* STMT might still have DEFS and we need to invalidate any known
+ equivalences for them.
+
+ Consider if STMT is a GIMPLE_ASM with one or more outputs that
+ feeds a conditional inside a loop. We might derive an equivalence
+ due to the conditional. */
+ tree op;
+ ssa_op_iter iter;
+
+ if (backedge_seen)
+ FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_DEF)
+ {
+ /* This call only invalidates equivalences created by
+ PHI nodes. This is by design to keep the cost of
+ of invalidation reasonable. */
+ invalidate_equivalences (op, stack, src_map, dst_map);
+
+ /* However, conditionals can imply values for real
+ operands as well. And those won't be recorded in the
+ maps. In fact, those equivalences may be recorded totally
+ outside the threading code. We can just create a new
+ temporary NULL equivalence here. */
+ record_temporary_equivalence (op, NULL_TREE, stack);
+ }
+
+ continue;
+ }
/* The result of __builtin_object_size depends on all the arguments
of a phi node. Temporarily using only one edge produces invalid

View File

@ -41,7 +41,7 @@
Name: gcc Name: gcc
Version: 4.9.0 Version: 4.9.0
Release: 1mamba Release: 2mamba
Summary: GNU Compiler Collection (C, C++, Fortran, Java, Ada) Summary: GNU Compiler Collection (C, C++, Fortran, Java, Ada)
Group: Applications/Development Group: Applications/Development
Vendor: openmamba Vendor: openmamba
@ -65,6 +65,7 @@ Patch11: %{name}-4.5.1-psignal_fix_bootstrap_build.patch
Patch12: %{name}-4.5.2-arm_define_ARM_PCS_and_ARM_PCS_VFP.patch Patch12: %{name}-4.5.2-arm_define_ARM_PCS_and_ARM_PCS_VFP.patch
Patch13: %{name}-4.5.3-avr-new-devices.patch Patch13: %{name}-4.5.3-avr-new-devices.patch
Patch14: gcc-4.8.0-libffi-texinfo.patch Patch14: gcc-4.8.0-libffi-texinfo.patch
Patch15: gcc-4.9.0-upstream-fixes-1.patch
License: GPL License: GPL
## AUTOBUILDREQ-BEGIN ## AUTOBUILDREQ-BEGIN
## AUTOBUILDREQ-END ## AUTOBUILDREQ-END
@ -72,6 +73,13 @@ License: GPL
BuildRequires: binutils BuildRequires: binutils
%else %else
BuildRequires: cross-%{_target_platform}-binutils BuildRequires: cross-%{_target_platform}-binutils
%if "%{?stage1}" != "1"
%if "%{?stage2}" != "2"
%if "%{target_cpu}" != "avr"
BuildRequires: cross-%{_target_platform}-glibc
%endif
%endif
%endif
%endif %endif
BuildRequires: libz-devel BuildRequires: libz-devel
BuildRequires: gettext BuildRequires: gettext
@ -461,9 +469,8 @@ AutoReqProv: no
Cross Platform gcc for %{_target_platform}. Cross Platform gcc for %{_target_platform}.
%prep %prep
%setup -n gcc-%{version}%{?gcc_extraver} -q %setup -n gcc-%{version}%{?gcc_extraver} -q -D -T
# -D -T :<< ___EOF
#:<< ___EOF
%patch2 -p0 %patch2 -p0
sed -i -e 's/libjawt/libgcjawt/g' libjava/Makefile.{am,in} sed -i -e 's/libjawt/libgcjawt/g' libjava/Makefile.{am,in}
@ -484,9 +491,10 @@ sed -i -e 's/libjawt/libgcjawt/g' libjava/Makefile.{am,in}
#%patch12 -p1 #%patch12 -p1
#%patch13 -p1 #%patch13 -p1
#%patch14 -p1 #%patch14 -p1
%patch15 -p1
%build %build
#:<< ____EOF :<< ____EOF
rm -rf ../%{name}-build rm -rf ../%{name}-build
mkdir ../%{name}-build && mkdir ../%{name}-build &&
@ -588,7 +596,6 @@ CROSS_SYSTEM_HEADER_DIR=/usr/%{_target_platform}/include \
--enable-java-awt=gtk \ --enable-java-awt=gtk \
--with-java-home=%{java_home} \ --with-java-home=%{java_home} \
--enable-libgcj-multifile \ --enable-libgcj-multifile \
--enable-install-libiberty \
--with-system-zlib \ --with-system-zlib \
%if "%{?disable_jack}" == "1" %if "%{?disable_jack}" == "1"
--disable-dssi \ --disable-dssi \
@ -597,6 +604,7 @@ CROSS_SYSTEM_HEADER_DIR=/usr/%{_target_platform}/include \
--enable-symvers=gnu \ --enable-symvers=gnu \
--with-local-prefix=/usr/%{_target_platform} \ --with-local-prefix=/usr/%{_target_platform} \
%else %else
--enable-install-libiberty \
--with-slibdir=$slibdir \ --with-slibdir=$slibdir \
%endif %endif
%endif %endif
@ -1064,9 +1072,9 @@ find %{buildroot}%{_libdir}/gcc -name lib*.a -exec chmod -w {} \;
%{_bindir}/gappletviewer %{_bindir}/gappletviewer
%{_bindir}/gjar %{_bindir}/gjar
%{_bindir}/gjavah %{_bindir}/gjavah
%if "%{disable_gjdoc}" != "1" #%if "%{disable_gjdoc}" != "1"
%{_bindir}/gjdoc %{_bindir}/gjdoc
%endif #%endif
%{_bindir}/gnative2ascii %{_bindir}/gnative2ascii
%{_bindir}/gorbd %{_bindir}/gorbd
%{_bindir}/gjarsigner %{_bindir}/gjarsigner
@ -1376,6 +1384,9 @@ find %{buildroot}%{_libdir}/gcc -name lib*.a -exec chmod -w {} \;
%endif %endif
%changelog %changelog
* Mon Jun 16 2014 Silvan Calarco <silvan.calarco@mambasoft.it> 4.9.0-2mamba
- apply upstream fixes to fix crashes seen in libQtScript after building Qt (seehttps://bugzilla.redhat.com/show_bug.cgi?id=1091482 )
* Sat May 03 2014 Automatic Build System <autodist@mambasoft.it> 4.9.0-1mamba * Sat May 03 2014 Automatic Build System <autodist@mambasoft.it> 4.9.0-1mamba
- automatic version update by autodist - automatic version update by autodist