Skip to content

Commit

Permalink
Merge pull request #2 from cooljeanius/me/CI
Browse files Browse the repository at this point in the history
Add linux ci
(thanks to @talregev for getting it started)
  • Loading branch information
cooljeanius authored Oct 16, 2023
2 parents 1f9d810 + b7c6ea0 commit 57f89bb
Show file tree
Hide file tree
Showing 36 changed files with 2,134 additions and 176 deletions.
167 changes: 167 additions & 0 deletions .github/workflows/linux.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
name: Linux
on:
push:
branches:
- master
- me/*
- releases/gcc-*
tags:
- releases/gcc-*
pull_request:
branches:
- master
- me/*
- releases/gcc-*

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
build:
name: ${{ matrix.name }}-build
runs-on: ubuntu-latest
timeout-minutes: 720
strategy:
matrix:
include:
- name: ubuntu-x64
target: x86_64

fail-fast: false
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2

- name: Install dependencies
run: |
sudo apt-get -qq update
sudo apt install -y gcc-multilib build-essential flex zlib1g-dev gnat gdc expect dejagnu libc-dev libc-devtools texlive findutils binutils autogen gettext autopoint libasprintf-dev libgettextpo-dev mailutils mailutils-mh procmail postfix emacs
- name: Install dependencies for aarch64
if: success() && contains(matrix.target, 'aarch64')
run: |
sudo apt-get -y install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu
- name: Stamp
if: success()
env:
revision: ${{ github.head_ref }}
run: |
if test -z "${revision}"; then revision=0; fi
{
date
echo "$(TZ=UTC date) (revision ${revision})"
} > LAST_UPDATED
- name: Cache
id: cache-deps
uses: actions/cache@v3
env:
cache-name: cache-downloaded-prerequisites
with:
path: ../build
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('LAST_UPDATED') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Download prerequisites
if: success()
run: |
./contrib/download_prerequisites
ls
- name: Configure x86_64
if: success() && matrix.target == 'x86_64'
run: |
if test -n "${ADA_INCLUDE_PATH}"; then unset ADA_INCLUDE_PATH; fi
if test -n "${ADA_OBJECT_PATH}"; then unset ADA_OBJECT_PATH; fi
cd ../
if test ! -d build; then mkdir build; fi
cd build
../gcc/configure \
--enable-languages=c,c++,lto,objc,obj-c++ \
--prefix=/usr \
--with-gcc-major-version-only \
--program-prefix=x86_64-linux-gnu- \
--libexecdir=/usr/lib \
--without-included-gettext \
--enable-threads=posix \
--libdir=/usr/lib \
--disable-vtable-verify \
--with-system-zlib \
--with-target-system-zlib=auto \
--disable-bootstrap \
--disable-werror \
--with-tune=generic \
--without-cuda-driver \
--enable-checking=release \
--enable-silent-rules \
--build=x86_64-linux-gnu \
--host=x86_64-linux-gnu \
--target=x86_64-linux-gnu
- name: Make
if: success()
run: |
cd ../build
if test -x "$(which nproc)"; then echo "nproc says that we can use $(nproc) build jobs"; else echo "error: missing nproc!" >&2 && exit 1; fi
time (make -j"$(nproc)" | tee build.log)
if test -e build.log; then stat build.log && wc -l build.log; fi
- name: Debug failure
if: failure()
run: |
if test -r build.log; then grep -i "error:" build.log; \
elif test -r ../build/build.log; then grep -i "error:" ../build/build.log; \
else \
sudo apt install remake; \
cd ../build; \
remake -dpPw --trace=full; \
fi
- name: Make docs (post-build)
if: success()
run: |
cd ../build
echo "make info" && (time make info) && find . -name "*.info" -print
echo "make dvi" && (time make dvi) && find . -name "*.dvi" -print
echo "make pdf" && (time make pdf) && find . -name "*.pdf" -print
echo "make html" && (time make html) && find . -name "*.html" -print
- name: Make install (plus docs)
if: success()
run: |
cd ../build
sudo make install
sudo make install-info
sudo make install-dvi
sudo make install-pdf
sudo make install-html
sudo make dir.info
- name: Tests
if: success()
run: |
if test -x /usr/bin/x86_64-linux-gnu-gcc; then /usr/bin/x86_64-linux-gnu-gcc --version; elif test -x ../build/gcc/xgcc; then ../build/gcc/xgcc --version; fi
if test -x /usr/bin/x86_64-linux-gnu-gcc; then /usr/bin/x86_64-linux-gnu-gcc -v; elif test -x ../build/gcc/xgcc; then ../build/gcc/xgcc --v; fi
cd ../build
if test -e build.log; then make warning.log; fi
time (make -k -j"$(nproc)" check RUNTESTFLAGS="compile.exp dg-torture.exp execute.exp old-deja.exp" | tee testsuite_output.log)
if test -e warning.log; then make mail-report-with-warnings.log; else make mail-report.log; fi
if test -x "$(which Mail)"; then \
if test -x mail-report-with-warnings.log; then \
./mail-report-with-warnings.log; \
elif test -x mail-report.log; then \
./mail-report.log; \
elif test -e testsuite_output.log; then \
echo "TODO: figure out a way to send testsuite_output.log"; \
else \
echo "Nothing to send."; \
fi; \
else \
echo "Warning: \"Mail\" program is missing, so skipping emailing of testresults!"; \
fi
2 changes: 0 additions & 2 deletions gcc/cp/module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5158,7 +5158,6 @@ trees_out::start (tree t, bool code_streamed)
case INTEGER_CST:
u (TREE_INT_CST_NUNITS (t));
u (TREE_INT_CST_EXT_NUNITS (t));
u (TREE_INT_CST_OFFSET_NUNITS (t));
break;

case OMP_CLAUSE:
Expand Down Expand Up @@ -5231,7 +5230,6 @@ trees_in::start (unsigned code)
unsigned n = u ();
unsigned e = u ();
t = make_int_cst (n, e);
TREE_INT_CST_OFFSET_NUNITS(t) = u ();
}
break;

Expand Down
1 change: 1 addition & 0 deletions gcc/fortran/gfortran.h
Original file line number Diff line number Diff line change
Expand Up @@ -1000,6 +1000,7 @@ typedef struct
unsigned omp_declare_target:1;
unsigned omp_declare_target_link:1;
ENUM_BITFIELD (gfc_omp_device_type) omp_device_type:2;
unsigned omp_allocate:1;

/* Mentioned in OACC DECLARE. */
unsigned oacc_declare_create:1;
Expand Down
9 changes: 8 additions & 1 deletion gcc/fortran/match.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5541,6 +5541,7 @@ gfc_free_omp_namelist (gfc_omp_namelist *name, bool free_ns,
bool free_mem_traits_space)
{
gfc_omp_namelist *n;
gfc_expr *last_allocator = NULL;

for (; name; name = n)
{
Expand All @@ -5552,7 +5553,13 @@ gfc_free_omp_namelist (gfc_omp_namelist *name, bool free_ns,
if (free_ns)
gfc_free_namespace (name->u2.ns);
else if (free_align_allocator)
gfc_free_expr (name->u2.allocator);
{
if (last_allocator != name->u2.allocator)
{
last_allocator = name->u2.allocator;
gfc_free_expr (name->u2.allocator);
}
}
else if (free_mem_traits_space)
{ } /* name->u2.traits_sym: shall not call gfc_free_symbol here. */
else if (name->u2.udr)
Expand Down
62 changes: 48 additions & 14 deletions gcc/fortran/openmp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2032,11 +2032,9 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const omp_mask mask,

for (gfc_omp_namelist *n = *head; n; n = n->next)
{
n->u2.allocator = ((allocator)
? gfc_copy_expr (allocator) : NULL);
n->u2.allocator = allocator;
n->u.align = (align) ? gfc_copy_expr (align) : NULL;
}
gfc_free_expr (allocator);
gfc_free_expr (align);
continue;
}
Expand Down Expand Up @@ -4547,9 +4545,8 @@ gfc_match_omp_allocate (void)
for (; vars; vars = vars->next)
{
vars->u.align = (align) ? gfc_copy_expr (align) : NULL;
vars->u2.allocator = ((allocator) ? gfc_copy_expr (allocator) : NULL);
vars->u2.allocator = allocator;
}
gfc_free_expr (allocator);
gfc_free_expr (align);
}
return MATCH_YES;
Expand Down Expand Up @@ -7191,7 +7188,7 @@ resolve_omp_udr_clause (gfc_omp_namelist *n, gfc_namespace *ns,
/* Assume that a constant expression in the range 1 (omp_default_mem_alloc)
to 8 (omp_thread_mem_alloc) range is fine. The original symbol name is
already lost during matching via gfc_match_expr. */
bool
static bool
is_predefined_allocator (gfc_expr *expr)
{
return (gfc_resolve_expr (expr)
Expand All @@ -7209,19 +7206,28 @@ is_predefined_allocator (gfc_expr *expr)
void
gfc_resolve_omp_allocate (gfc_namespace *ns, gfc_omp_namelist *list)
{
for (gfc_omp_namelist *n = list; n; n = n->next)
n->sym->mark = 0;
for (gfc_omp_namelist *n = list; n; n = n->next)
{
if (n->sym->attr.result || n->sym->result == n->sym)
{
gfc_error ("Unexpected function-result variable %qs at %L in "
"declarative !$OMP ALLOCATE", n->sym->name, &n->where);
continue;
}
if (ns->omp_allocate->sym->attr.proc_pointer)
{
gfc_error ("Procedure pointer %qs not supported with !$OMP "
"ALLOCATE at %L", n->sym->name, &n->where);
continue;
}
if (n->sym->attr.flavor != FL_VARIABLE)
{
gfc_error ("Argument %qs at %L to declarative !$OMP ALLOCATE "
"directive must be a variable", n->sym->name,
&n->where);
continue;
}
if (ns != n->sym->ns || n->sym->attr.use_assoc
|| n->sym->attr.host_assoc || n->sym->attr.imported)
if (ns != n->sym->ns || n->sym->attr.use_assoc || n->sym->attr.imported)
{
gfc_error ("Argument %qs at %L to declarative !$OMP ALLOCATE shall be"
" in the same scope as the variable declaration",
Expand All @@ -7234,7 +7240,13 @@ gfc_resolve_omp_allocate (gfc_namespace *ns, gfc_omp_namelist *list)
"declarative !$OMP ALLOCATE", n->sym->name, &n->where);
continue;
}
if (n->sym->mark)
if (n->sym->attr.codimension)
{
gfc_error ("Unexpected coarray argument %qs as argument at %L to "
"declarative !$OMP ALLOCATE", n->sym->name, &n->where);
continue;
}
if (n->sym->attr.omp_allocate)
{
if (n->sym->attr.in_common)
{
Expand All @@ -7249,7 +7261,28 @@ gfc_resolve_omp_allocate (gfc_namespace *ns, gfc_omp_namelist *list)
n->sym->name, &n->where);
continue;
}
n->sym->mark = 1;
/* For 'equivalence(a,b)', a 'union_type {<type> a,b} equiv.0' is created
with a value expression for 'a' as 'equiv.0.a' (likewise for b); while
this can be handled, EQUIVALENCE is marked as obsolescent since Fortran
2018 and also not widely used. However, it could be supported,
if needed. */
if (n->sym->attr.in_equivalence)
{
gfc_error ("Sorry, EQUIVALENCE object %qs not supported with !$OMP "
"ALLOCATE at %L", n->sym->name, &n->where);
continue;
}
/* Similar for Cray pointer/pointee - they could be implemented but as
common vendor extension but nowadays rarely used and requiring
-fcray-pointer, there is no need to support them. */
if (n->sym->attr.cray_pointer || n->sym->attr.cray_pointee)
{
gfc_error ("Sorry, Cray pointers and pointees such as %qs are not "
"supported with !$OMP ALLOCATE at %L",
n->sym->name, &n->where);
continue;
}
n->sym->attr.omp_allocate = 1;
if ((n->sym->ts.type == BT_CLASS && n->sym->attr.class_ok
&& CLASS_DATA (n->sym)->attr.allocatable)
|| (n->sym->ts.type != BT_CLASS && n->sym->attr.allocatable))
Expand Down Expand Up @@ -7307,8 +7340,6 @@ gfc_resolve_omp_allocate (gfc_namespace *ns, gfc_omp_namelist *list)
"%<omp_allocator_handle_kind%> kind at %L",
&n->u2.allocator->where);
}
gfc_error ("Sorry, declarative !$OMP ALLOCATE at %L not yet supported",
&list->where);
}

/* Resolve ASSUME's and ASSUMES' assumption clauses. Note that absent/contains
Expand Down Expand Up @@ -7897,6 +7928,9 @@ resolve_omp_clauses (gfc_code *code, gfc_omp_clauses *omp_clauses,
{
if (n->sym == NULL)
continue;
if (n->sym->attr.codimension)
gfc_error ("Unexpected coarray %qs in %<allocate%> at %L",
n->sym->name, &n->where);
for (a = code->block->next->ext.alloc.list; a; a = a->next)
if (a->expr->expr_type == EXPR_VARIABLE
&& a->expr->symtree->n.sym == n->sym)
Expand Down
8 changes: 4 additions & 4 deletions gcc/fortran/parse.cc
Original file line number Diff line number Diff line change
Expand Up @@ -833,18 +833,18 @@ check_omp_allocate_stmt (locus *loc)
&n->expr->where, gfc_ascii_statement (ST_OMP_ALLOCATE));
return false;
}
/* Procedure pointers are not allocatable; hence, we do not regard them as
pointers here - and reject them later in gfc_resolve_omp_allocate. */
bool alloc_ptr;
if (n->sym->ts.type == BT_CLASS && n->sym->attr.class_ok)
alloc_ptr = (CLASS_DATA (n->sym)->attr.allocatable
|| CLASS_DATA (n->sym)->attr.class_pointer);
else
alloc_ptr = (n->sym->attr.allocatable || n->sym->attr.pointer
|| n->sym->attr.proc_pointer);
alloc_ptr = n->sym->attr.allocatable || n->sym->attr.pointer;
if (alloc_ptr
|| (n->sym->ns && n->sym->ns->proc_name
&& (n->sym->ns->proc_name->attr.allocatable
|| n->sym->ns->proc_name->attr.pointer
|| n->sym->ns->proc_name->attr.proc_pointer)))
|| n->sym->ns->proc_name->attr.pointer)))
has_allocatable = true;
else
has_non_allocatable = true;
Expand Down
Loading

0 comments on commit 57f89bb

Please sign in to comment.