Merge branch 'c10s' into a10s

This commit is contained in:
eabdullin 2025-02-04 13:32:28 +03:00
commit 9da8d7bed9
18 changed files with 470 additions and 80 deletions

1
.gitignore vendored
View File

@ -15,3 +15,4 @@
/nvptx-tools-87ce9dc5999e5fca2e1d3478a30888d9864c9804.tar.xz
/gcc-14.2.1-20240801.tar.xz
/gcc-14.2.1-20241104.tar.xz
/gcc-14.2.1-20250110.tar.xz

View File

@ -1,10 +1,10 @@
%global DATE 20241104
%global gitrev b84ce6a258e01f6559a1855b5f1d1ba4e69a927b
%global DATE 20250110
%global gitrev e525669e462dd777a1af9932fe9188937acdeb69
%global gcc_version 14.2.1
%global gcc_major 14
# Note, gcc_release must be integer, if you want to add suffixes to
# %%{release}, append them after %%{gcc_release} on Release: line.
%global gcc_release 6
%global gcc_release 7
%global nvptx_tools_gitrev 87ce9dc5999e5fca2e1d3478a30888d9864c9804
%global newlib_cygwin_gitrev d45261f62a15f8abd94a1031020b9a9f455e4eed
%global _unpackaged_files_terminate_build 0
@ -305,6 +305,7 @@ Patch9: gcc14-Wno-format-security.patch
Patch10: gcc14-rh1574936.patch
Patch11: gcc14-d-shared-libphobos.patch
Patch12: gcc14-pr101523.patch
Patch13: gcc14-pr118509.patch
Patch50: isl-rh2155127.patch
@ -906,6 +907,7 @@ so that there cannot be any synchronization problems.
%endif
%patch -P11 -p0 -b .d-shared-libphobos~
%patch -P12 -p1 -b .pr101523~
%patch -P13 -p0 -b .pr118509~
%patch -P50 -p0 -b .rh2155127~
touch -r isl-0.24/m4/ax_prog_cxx_for_build.m4 isl-0.24/m4/ax_prog_cc_for_build.m4
@ -928,10 +930,8 @@ cp -a libstdc++-v3/config/cpu/i{4,3}86/atomicity.h
LC_ALL=C sed -i -e 's/\xa0/ /' gcc/doc/options.texi
sed -i -e '/ldp_fusion/s/Init(1)/Init(0)/' gcc/config/aarch64/aarch64.opt
sed -i -e 's/Common Driver Var(flag_report_bug)/& Init(1)/' gcc/common.opt
sed -i -e 's/context->report_bug = false;/context->report_bug = true;/' gcc/diagnostic.cc
sed -i -e 's/m_report_bug = false;/m_report_bug = true;/' gcc/diagnostic.cc
%ifarch ppc
if [ -d libstdc++-v3/config/abi/post/powerpc64-linux-gnu ]; then
@ -3624,10 +3624,56 @@ end
%endif
%changelog
* Fri Dec 06 2024 Eduard Abdullin <eabdullin@almalinux.org> - 14.2.1-6.alma.1
* Tue Feb 04 2025 Eduard Abdullin <eabdullin@almalinux.org> - 14.2.1-7.alma.1
- Change to almalinux bugtracker
- Set --with-arch_64=x86-64-v2 on v2 arch
* Tue Jan 21 2025 Marek Polacek <polacek@redhat.com> 14.2.1-7
- update from releases/gcc-14 branch (RHEL-65532)
- PRs ada/113036, ada/113868, ada/115917, ada/117328, ada/117996,
analyzer/115724, c/117641, c/117745, c/117802, c++/100358, c++/101463,
c++/102594, c++/109859, c++/113108, c++/114854, c++/115008,
c++/115430, c++/115657, c++/116108, c++/116634, c++/117158,
c++/117317, c++/117614, c++/117615, c++/117792, c++/117825,
c++/117845, c++/117880, c++/117925, c++/117985, c++/118060,
c++/118069, driver/117942, fortran/84674, fortran/84869,
fortran/105054, fortran/109105, fortran/109345, fortran/115070,
fortran/115348, fortran/116388, fortran/117730, fortran/117763,
fortran/117774, fortran/117791, fortran/117797, fortran/117819,
fortran/117820, fortran/117843, fortran/117897, libgomp/117851,
libstdc++/89624, libstdc++/106212, libstdc++/106676, libstdc++/108236,
libstdc++/109517, libstdc++/109976, libstdc++/112349,
libstdc++/112641, libstdc++/117520, libstdc++/117560,
libstdc++/117822, libstdc++/117962, libstdc++/117966,
libstdc++/118035, libstdc++/118093, middle-end/43374,
middle-end/102674, middle-end/116997, middle-end/117433,
middle-end/117458, middle-end/117459, middle-end/117847,
middle-end/118024, modula2/114529, modula2/115003, modula2/115057,
modula2/115164, modula2/115276, modula2/115328, modula2/115536,
modula2/115540, modula2/115804, modula2/115823, modula2/115957,
modula2/116048, modula2/116181, modula2/116378, modula2/116557,
modula2/116918, modula2/117120, modula2/117371, modula2/117555,
modula2/117660, modula2/117904, modula2/117948, other/116603,
preprocessor/117118, rtl-optimization/113994, rtl-optimization/116799,
rtl-optimization/117095, sanitizer/117960, target/64242,
target/114801, target/114942, target/116371, target/116629,
target/116999, target/117045, target/117105, target/117304,
target/117357, target/117408, target/117418, target/117443,
target/117500, target/117525, target/117562, target/117564,
target/117642, target/117659, target/117675, target/117744,
target/117926, testsuite/103298, testsuite/109360,
tree-optimization/94589, tree-optimization/112376,
tree-optimization/116463, tree-optimization/117142,
tree-optimization/117254, tree-optimization/117307,
tree-optimization/117333, tree-optimization/117398,
tree-optimization/117417, tree-optimization/117439,
tree-optimization/117574, tree-optimization/117594,
tree-optimization/117612, tree-optimization/117912
- fix up -freport-bug default (#2330362, RHEL-73475)
- revert -mearly-ldp-fusion and -mlate-ldp-fusion default to enabled on
aarch64 to match upstream (RHEL-73585)
- consider TARGET_EXPR invariant like SAVE_EXPR (PR c++/118509)
* Wed Nov 6 2024 Joseph Myers <josmyers@redhat.com> - 14.2.1-6
- update from releases/gcc-14 branch
- PRs ada/114593, ada/114636, ada/114640, ada/115535, ada/116190,

56
gcc14-pr118509.patch Normal file
View File

@ -0,0 +1,56 @@
2025-01-20 Jakub Jelinek <jakub@redhat.com>
PR c++/118509
* typeck.cc (get_member_function_from_ptrfunc): Wrap force_target_expr
with save_expr.
* g++.dg/expr/pmf-4.C: New test.
--- gcc/cp/typeck.cc.jj 2025-01-09 10:10:28.042651891 +0100
+++ gcc/cp/typeck.cc 2025-01-20 15:09:24.200053590 +0100
@@ -4187,8 +4187,8 @@ get_member_function_from_ptrfunc (tree *
&& !DECL_P (instance_ptr)
&& !TREE_CONSTANT (instance_ptr)))
instance_ptr = instance_save_expr
- = force_target_expr (TREE_TYPE (instance_ptr), instance_ptr,
- complain);
+ = save_expr (force_target_expr (TREE_TYPE (instance_ptr),
+ instance_ptr, complain));
/* See above comment. */
if (TREE_SIDE_EFFECTS (function)
@@ -4196,7 +4196,8 @@ get_member_function_from_ptrfunc (tree *
&& !DECL_P (function)
&& !TREE_CONSTANT (function)))
function
- = force_target_expr (TREE_TYPE (function), function, complain);
+ = save_expr (force_target_expr (TREE_TYPE (function), function,
+ complain));
/* Start by extracting all the information from the PMF itself. */
e3 = pfn_from_ptrmemfunc (function);
--- gcc/testsuite/g++.dg/expr/pmf-4.C.jj
+++ gcc/testsuite/g++.dg/expr/pmf-4.C
@@ -0,0 +1,22 @@
+// PR c++/118509
+// { dg-do run }
+// { dg-options "-Wall -O2" }
+
+struct A { void foo () { a = 1; } int a; A () : a (0) {} };
+struct B : virtual A {};
+typedef void (A::*C) ();
+
+__attribute__((noipa)) void
+foo (C x, B *y)
+{
+ (y->*x) ();
+}
+
+int
+main ()
+{
+ B b;
+ foo (&A::foo, &b);
+ if (b.a != 1)
+ __builtin_abort ();
+}

View File

@ -1,13 +1,5 @@
summary: CI Gating Plan
discover:
how: fmf
url: https://src.fedoraproject.org/tests/gcc.git
filter: 'tag: Fedora-CI-gating'
execute:
how: tmt
adjust:
- prepare+:
- name: Add secondary architecture RPMs
how: shell
script: ./plans/provide_secondary_arch_rpms.sh
when: arch == x86_64

View File

@ -1,64 +0,0 @@
#!/usr/bin/env bash
# Fedora CI testing systems don't provide a repository with the i686
# RPMs of the build being tested. As a consequence, most
# dnf install -y <some-gcc-rpm>.i686
# commands (whether being run by a test or by TMT's prepare) will probably
# fail on a version mismatch with the present x86_64 gcc RPMs. To prevent
# such failures we provide this script which we recommend to include in every
# Fedora CI test plan.
#
# Implementation notes:
#
# * The gcc build being tested in Fedora CI is given via KOJI_TASK_ID. See
# https://github.com/fedora-ci/dist-git-pipeline/pull/50 for details.
#
# * Currently this script just downloads and installs the i686 RPMs. It
# would not be sufficient for tests that uninstall and reinstall those
# RPMs. If such a test appears, this script should create a repository.
#
# * Fedora CI testing systems seem to have extremely small RAM-based /tmp,
# unable to host all the downloaded RPMs, and no other "real" filesystem
# than "/". That's the reason for using
# mktemp -d --tmpdir=/
set -x
true "V-V-V-V-V-V-V-V-V-V-V-V-V-V-V-V-V-V-V-V-V-V-V-V-V-V-V-V-V-V-V-V-V-V-V"
echo "KOJI_TASK_ID=$KOJI_TASK_ID"
. /etc/os-release
echo "ID=$ID"
echo "arch=$(arch)"
echo "KOJI_TASK_ID=$KOJI_TASK_ID"
if [[ "$ID" = fedora ]] && [[ "$(arch)" = x86_64 ]] && [[ -n "$KOJI_TASK_ID" ]]; then
if tmpd=$(mktemp -d --tmpdir=/) && pushd "$tmpd"; then
# Download
rpm -q koji || dnf -y install koji
koji download-task "$KOJI_TASK_ID" --noprogress --arch={x86_64,i686,noarch}
# Remove conflicting RPMs
rm -f ./*debuginfo* ./*debugsource*
rm -f gcc-[0-9]*.i686.*
rm -f ./*docs*.i686.*
# Install
ls
dnf -y install ./*.rpm
# Clean up
# shellcheck disable=SC2164
popd
rm -rf "$tmpd"
fi
else
echo "Not applicable"
fi
true "^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^"

View File

@ -1,4 +1,4 @@
SHA512 (isl-0.24.tar.bz2) = aab3bddbda96b801d0f56d2869f943157aad52a6f6e6a61745edd740234c635c38231af20bc3f1a08d416a5e973a90e18249078ed8e4ae2f1d5de57658738e95
SHA512 (newlib-cygwin-d45261f62a15f8abd94a1031020b9a9f455e4eed.tar.xz) = 31bfc19429797236e268e22b752c5abeabb9c0f39b1058634af8dab329b4f028fc72a35888193c9575f6cee5cf2c069669d79fcb4d4e3a4318f57413452f707d
SHA512 (nvptx-tools-87ce9dc5999e5fca2e1d3478a30888d9864c9804.tar.xz) = 941e763af8601b89f0e4ec48a2d68ae0a8e70ee1e6ba6859394b021ad7bd7d143cc529f3c35c08d7f84e5554980ddcc97cf05b6c4755c2bc36c91161b79e8cea
SHA512 (gcc-14.2.1-20241104.tar.xz) = 4a453e1b7e2712fd2a12d28cf2aaf8e76c789f7e747218cdf867eaca84e381305bf119c7db873c5c3f0981657dbefcded77ad74a0960034b95232d906e4b02d0
SHA512 (gcc-14.2.1-20250110.tar.xz) = 9de1009fd87d3734361a3c451e0d8faac984a38b2c064bea228b1a04738e870d7dcca2ee98182be5423579b8caa5f762cd06a6576e2fe797559620619ae4e169

65
tests/smoke-test/Makefile Normal file
View File

@ -0,0 +1,65 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /tools/gcc/Sanity/smoke-test
# Description: Basic smoke test.
# Author: Marek Polacek <polacek@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2012 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# This program 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 this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/tools/gcc/Sanity/smoke-test
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE hello.c hello.f90 hello.cpp tm.c quad.c omphello.c thr-init-2.c clear_cache.c
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
test -x runtest.sh || chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Marek Polacek <mpolacek@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Basic smoke test." >> $(METADATA)
@echo "Type: Sanity" >> $(METADATA)
@echo "TestTime: 10m" >> $(METADATA)
@echo "RunFor: gcc" >> $(METADATA)
@echo "RunFor: devtoolset-1.0-gcc" >> $(METADATA)
@echo "Requires: gcc gcc-c++ gcc-gfortran glibc-common glibc-devel" >> $(METADATA)
@echo "Requires: libquadmath libquadmath-devel libgomp libgcc libstdc++-devel" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
rhts-lint $(METADATA)

3
tests/smoke-test/PURPOSE Normal file
View File

@ -0,0 +1,3 @@
PURPOSE of /tools/gcc/Sanity/smoke-test
Description: Basic smoke test.
Author: Marek Polacek <polacek@redhat.com>

View File

@ -0,0 +1,7 @@
int
main (void)
{
char *mem = __builtin_alloca (40);
__builtin___clear_cache (mem, mem + 40);
return 0;
}

7
tests/smoke-test/hello.c Normal file
View File

@ -0,0 +1,7 @@
#include <stdio.h>
int
main (void)
{
puts ("Hello World!");
}

View File

@ -0,0 +1,7 @@
#include <iostream>
int
main (void)
{
std::cout << "Hello, world!\n";
}

View File

@ -0,0 +1,3 @@
program hello
print *, "Hello World!"
end program hello

22
tests/smoke-test/main.fmf Normal file
View File

@ -0,0 +1,22 @@
summary: Basic smoke test.
description: ''
contact:
- Marek Polacek <mpolacek@redhat.com>
component:
- gcc
test: ./runtest.sh
framework: beakerlib
recommend:
- gcc
- gcc-c++
- gcc-gfortran
- glibc-common
- glibc-devel
- libquadmath
- libquadmath-devel
- libgomp
- libgcc
- libstdc++-devel
duration: 10m
extra-summary: /tools/gcc/Sanity/smoke-test
extra-task: /tools/gcc/Sanity/smoke-test

View File

@ -0,0 +1,24 @@
#include <omp.h>
#include <stdio.h>
#include <stdlib.h>
int
main (void)
{
int th_id;
int nthreads;
#pragma omp parallel private(th_id)
{
th_id = omp_get_thread_num ();
printf ("Hello World from thread %d\n", th_id);
#pragma omp barrier
if (th_id == 0)
{
nthreads = omp_get_num_threads ();
printf ("There are %d threads\n", nthreads);
}
}
return EXIT_SUCCESS;
}

38
tests/smoke-test/quad.c Normal file
View File

@ -0,0 +1,38 @@
#include <quadmath.h>
#include <stdlib.h>
#include <stdio.h>
int
main (void)
{
__float128 r = strtoflt128 ("1.23456789", NULL);
int prec = 20;
int width = 46;
char buf[128];
r = 2.0q;
r = sqrtq (r);
int n = quadmath_snprintf (buf, sizeof buf, "%+-#*.20Qe", width, r);
if ((size_t) n < sizeof buf)
/* Prints: +1.41421356237309504880e+00 */
printf ("%s\n", buf);
quadmath_snprintf (buf, sizeof buf, "%Qa", r);
if ((size_t) n < sizeof buf)
/* Prints: 0x1.6a09e667f3bcc908b2fb1366ea96p+0 */
printf ("%s\n", buf);
n = quadmath_snprintf (NULL, 0, "%+-#46.*Qe", prec, r);
if (n > -1)
{
char *str = malloc (n + 1);
if (str)
{
quadmath_snprintf (str, n + 1, "%+-#46.*Qe", prec, r);
/* Prints: +1.41421356237309504880e+00 */
printf ("%s\n", str);
}
free (str);
}
return 0;
}

125
tests/smoke-test/runtest.sh Executable file
View File

@ -0,0 +1,125 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/gcc/Sanity/smoke-test
# Description: Basic smoke test.
# Author: Marek Polacek <polacek@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2012 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# This program 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 this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGES=(gcc gcc-c++ gcc-gfortran glibc-common libgomp libgcc glibc-devel libstdc++ libstdc++-devel)
# Choose the compiler.
GCC=${GCC:-gcc}
GXX=${GXX:-g++}
GFORTRAN=${GFORTRAN:-gfortran}
PACKAGE=gcc
rlJournalStart
rlPhaseStartSetup
export PRI_ARCH=`rlGetPrimaryArch`
export SEC_ARCH=`rlGetSecondaryArch`
# don't assert anything under devtoolset
if type gcc | grep -q -v devtoolset
then
for p in "${PACKAGES[@]}"; do
rpm -q "$p.$PRI_ARCH" || yum install -y "$p.$PRI_ARCH"
rlAssertRpm "$p.$PRI_ARCH"
done; unset p
fi
rlLog "GCC = $GCC"
rlLog "Installed within `rpmquery -f $(which $GCC)`"
rlLog "GXX = $GXX"
rlLog "Installed within `rpmquery -f $(which $GXX)`"
rlLog "GFORTRAN = $GFORTRAN"
rlLog "Installed within `rpmquery -f $(which $GFORTRAN)`"
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
# We need some files.
rlRun "cp -v hello.{c,cpp,f90} tm.c quad.c thr-init-2.c clear_cache.c omphello.c $TmpDir"
rlRun "pushd $TmpDir"
rlRun "rpmquery -l libstdc++-devel.$PRI_ARCH"
test -n "$SEC_ARCH" && rpmquery "libstdc++-devel.$SEC_ARCH" && rlRun "rpmquery -l libstdc++-devel.$SEC_ARCH"
rlPhaseEnd
rlPhaseStartSetup "Showing compiler versions"
for compiler in $GCC $GXX $GFORTRAN
do
rlLog "Version of compiler: $compiler"
eval "$compiler --version 2>&1" | while read line
do
rlLog " $line"
done
done
rlPhaseEnd
rlPhaseStartTest "Compile"
rlRun "$GCC hello.c -o hello_c"
rlRun "$GXX hello.cpp -o hello_cpp"
rlRun "$GFORTRAN hello.f90 -o hello_fortran"
# TM support is GCC >=4.7 only.
$GCC -xc -O2 -std=gnu99 -fgnu-tm - <<< "int main(){}"
if test $? -eq 0; then
rlRun "$GCC -O2 -std=gnu99 -fgnu-tm tm.c -o tm"
rlRun "./tm"
fi
# Test OpenMP.
rlRun "$GCC omphello.c -O2 -std=gnu99 -fopenmp -o omp"
rlRun "./omp"
# Test __thread.
rlRun "$GCC thr-init-2.c -O2 -std=gnu99 -ftls-model=initial-exec -o thr"
rlRun "./thr"
# Now test some libquadmath stuff (__float128 support).
# libquadmath is mising on RHEL machines, usually.
test "`rpmquery --qf '%{version}-%{release}' libquadmath`" = "`rpmquery --qf '%{version}-%{release}' $GCC`"
if test $? -eq 0 -a "$GCC" = "gcc"; then
rlRun "$GCC quad.c -O2 -std=gnu99 -lquadmath -lm -o quad"
rlRun "./quad"
fi
# And now something from libgcc, e.g. __builtin___clear_cache.
# But not on RHEL5.
if ! rlIsRHEL 5; then
rlRun "$GCC clear_cache.c -O2 -std=gnu99 -o cache"
rlRun "./cache"
fi
rlPhaseEnd
rlPhaseStartTest "Check dependant libraries"
rlRun "ldd hello_{c,cpp,fortran} &> ldd.out"
# Nothing should be linked against anything in /opt.
rlAssertNotGrep "/opt" ldd.out
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View File

@ -0,0 +1,24 @@
/* { dg-do run } */
/* { dg-require-effective-target tls_runtime } */
/* { dg-add-options tls } */
extern void abort() ;
static __thread int fstat ;
static __thread int fstat = 1;
int test_code(int b)
{
fstat += b ;
return fstat;
}
int main (int ac, char *av[])
{
int a = test_code(1);
if ((a != 2) || (fstat != 2))
abort () ;
return 0;
}

34
tests/smoke-test/tm.c Normal file
View File

@ -0,0 +1,34 @@
extern void *malloc (__SIZE_TYPE__) __attribute__((malloc,transaction_safe));
static int __attribute__((transaction_safe))
something (void)
{
return 0;
}
struct large { int foo[500]; };
int
main (void)
{
int *p;
struct large *lp;
__transaction_atomic {
p = malloc (sizeof (*p) * 100);
lp = malloc (sizeof (*lp) * 100);
/* No instrumentation necessary; P and LP are transaction local. */
p[5] = 123;
lp->foo[66] = 123;
if (something ())
__transaction_cancel;
}
__transaction_relaxed {
++p[5];
}
return ( (p[5] == 124) ? 0 : 1 );
}