Commit Graph

1920 Commits

Author SHA1 Message Date
Jakub Jelinek 7adcbafe45 Update copyright years. 2022-01-03 10:42:10 +01:00
Jakub Jelinek 6123f29a18 Rotate ChangeLog files - step 2 - remove 2021 entries from ChangeLog files.
Can't be committed together with the previous one due to the ChangeLog vs.
other files restrictions.
2022-01-03 10:23:34 +01:00
Jakub Jelinek d04ae83244 Rotate ChangeLog files - part 1 - add ChangeLog-2021.
2022-01-03  Jakub Jelinek  <jakub@redhat.com>

gcc/
	* ChangeLog-2021: Rotate ChangeLog.  New file.
gcc/ada/
	* ChangeLog-2021: Rotate ChangeLog.  New file.
gcc/cp/
	* ChangeLog-2021: Rotate ChangeLog.  New file.
gcc/d/
	* ChangeLog-2021: Rotate ChangeLog.  New file.
gcc/fortran/
	* ChangeLog-2021: Rotate ChangeLog.  New file.
gcc/testsuite/
	* ChangeLog-2021: Rotate ChangeLog.  New file.
libgfortran/
	* ChangeLog-2021: Rotate ChangeLog.  New file.
libstdc++-v3/
	* ChangeLog-2021: Rotate ChangeLog.  New file.
2022-01-03 10:18:16 +01:00
GCC Administrator f17d2677bc Daily bump. 2022-01-01 00:16:17 +00:00
Iain Sandoe e3cbb8c66c libgfortran: Fix bootstrap on targets without static_assert macro.
Although we build the library with GCC which is known to support
_Static_assert this might be done on a system without the macro
mapping static_assert to the compiler keyword.

The use of static_assert introduced with r12-6126-g3430132f3e82
causes bootstrap to fail on such targets, fixed by using the keyword
directly.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

libgfortran/ChangeLog:

	* runtime/string.c (gfc_itoa): Use _Static_assert directly
	instead of via the static_assert macro.
2021-12-31 13:16:16 +00:00
GCC Administrator be475aa0aa Daily bump. 2021-12-30 00:16:43 +00:00
Francois-Xavier Coudert ade9130f50 Fortran: keep values of IEEE_CLASS_TYPE in sync
Fortran 2018 added some synonyms to the existing values, namely
IEEE_NEGATIVE_SUBNORMAL (which is the same as IEEE_NEGATIVE_DENORMAL)
and IEEE_POSITIVE_SUBNORMAL (same as IEEE_POSITIVE_DENORMAL). When they
were added to the C side, they were not kept in sync with the Fortran
part of the library. Thew new values are not used (yet), so it is
currently harmless, but better fix it.

libgfortran/ChangeLog:

	* ieee/ieee_helper.c: Fix enum values.
2021-12-29 21:37:28 +01:00
GCC Administrator d1e111daee Daily bump. 2021-12-28 00:16:37 +00:00
Francois-Xavier Coudert 3430132f3e Fortran: fix use of static_assert() to conform to C11
libgfortran/ChangeLog:

	PR libfortran/98076
	* runtime/string.c (gfc_itoa): Use two args for static_assert().
2021-12-27 21:32:08 +01:00
GCC Administrator ad6091d1b8 Daily bump. 2021-12-27 00:16:20 +00:00
Francois-Xavier Coudert 9525c26bf1 Fortran: speed up decimal output of integers
libgfortran/ChangeLog:

	PR libfortran/98076
	* runtime/string.c (itoa64, itoa64_pad19): New helper functions.
	(gfc_itoa): On targets with 128-bit integers, call fast
	64-bit functions to avoid many slow divisions.

gcc/testsuite/ChangeLog:

	PR libfortran/98076
	* gfortran.dg/pr98076.f90: New test.
2021-12-26 12:00:00 +01:00
GCC Administrator 10ae9946dc Daily bump. 2021-12-26 00:16:17 +00:00
Francois-Xavier Coudert 4ae906e46c Fortran: simplify library code for integer-to-decimal conversion
libgfortran/ChangeLog:

	PR libfortran/81986
	PR libfortran/99191

	* libgfortran.h: Remove gfc_xtoa(), adjust gfc_itoa() and
	GFC_ITOA_BUF_SIZE.
	* io/write.c (write_decimal): conversion parameter is always
	gfc_itoa(), so remove it. Protect from overflow.
	(xtoa): Move gfc_xtoa and update its name.
	(xtoa_big): Renamed from ztoa_big for consistency.
	(write_z): Adjust to new function names.
	(write_i, write_integer): Remove last arg of write_decimal.
	* runtime/backtrace.c (error_callback): Comment on the use of
	gfc_itoa().
	* runtime/error.c (gfc_xtoa): Move to io/write.c.
	* runtime/string.c (gfc_itoa): Take an unsigned argument,
	remove the handling of negative values.
2021-12-25 15:07:12 +01:00
GCC Administrator 9f9bc0bf0d Daily bump. 2021-12-23 00:16:29 +00:00
Francois-Xavier Coudert 228173565e Fortran: allow __float128 on targets where long double is not REAL(KIND=10)
The logic for detection of REAL(KIND=16) in kinds-override.h made
assumptions:

    -- if real(kind=10) exists, i.e. if HAVE_GFC_REAL_10 is defined,
       then it is necessarily the "long double" type
    -- if real(kind=16) exists, then:
       * if HAVE_GFC_REAL_10, real(kind=16) is "__float128"
       * otherwise, real(kind=16) is "long double"

This may not always be true. Take the aarch64-apple-darwin port,
it has double == long double == binary64, and __float128 == binary128.

We already have more fine-grained logic in the mk-kinds-h.sh script,
where we actually check the Fortran kind corresponding to C’s long
double. So let's use it, and emit the GFC_REAL_16_IS_FLOAT128 /
GFC_REAL_16_IS_LONG_DOUBLE macros there.

libgfortran/ChangeLog:

	* kinds-override.h: Move GFC_REAL_16_IS_* macros...
	* mk-kinds-h.sh: ... here.
2021-12-22 12:46:07 +01:00
GCC Administrator 29309f6e29 Daily bump. 2021-12-20 00:16:21 +00:00
Francois-Xavier Coudert 220b9bdfe8 Fortran: add support for IEEE intrinsics on aarch64 non-glibc targets
This enables IEEE support on the upcoming aarch64-apple-darwin target,
and has been tested for some time in an external port.

libgfortran/ChangeLog:

	* configure.host: Add aarch64-apple-darwin support.
	* config/fpu-aarch64.h: New file.
2021-12-20 00:49:10 +01:00
GCC Administrator ca8c0408be Daily bump. 2021-12-19 00:16:17 +00:00
François-Xavier Coudert 21423a1dfa Fortran: Cast arguments of <ctype.h> functions to unsigned char
Functions from <ctype.h> should only be called on values that can be
represented by unsigned char. On targets where char is a signed type,
some of libgfortran calls have undefined behaviour.

The solution is to cast the argument to unsigned char type. I’ve defined
macros in libgfortran.h to do so, to retain legibility of the library
code.

PR libfortran/95177

libgfortran/ChangeLog

	* libgfortran.h: include ctype.h, provide safe macros.
	* io/format.c: use safe macros.
	* io/list_read.c: use safe macros.
	* io/read.c: use safe macros.
	* io/write.c: use safe macros.
	* runtime/environ.c: use safe macros.
2021-12-18 09:21:16 +01:00
GCC Administrator 774269aa4b Daily bump. 2021-12-17 00:16:20 +00:00
Francois-Xavier Coudert c14f38d429 Fix FLUSH IOSTAT value
PR libfortran/101255

libgfortran/ChangeLog:

	* io/file_pos.c: Fix error code.

gcc/testsuite/ChangeLog:

	* gfortran.dg/iostat_5.f90: New file.
2021-12-16 17:46:28 +01:00
Francois-Xavier Coudert 3f624a624a Fix timezone handling near year boundaries
PR libfortran/98507

libgfortran/ChangeLog:

	* intrinsics/time_1.h: Prefer clock_gettime() over
	  gettimeofday().
	* intrinsics/date_and_time.c: Fix timezone wrapping.

gcc/testsuite/ChangeLog:

	* gfortran.dg/date_and_time_1.f90: New file.
2021-12-16 17:45:51 +01:00
GCC Administrator 9c6586bc20 Daily bump. 2021-12-15 00:16:28 +00:00
Harald Anlauf 1c613165a5 Fortran: PACK intrinsic should not try to read from zero-sized array
libgfortran/ChangeLog:

	PR libfortran/103634
	* intrinsics/pack_generic.c (pack_internal): Handle case when the
	array argument of PACK has one or more extents of size zero to
	avoid invalid reads.

gcc/testsuite/ChangeLog:

	PR libfortran/103634
	* gfortran.dg/intrinsic_pack_6.f90: New test.
2021-12-14 16:56:50 +01:00
GCC Administrator ce4d1f632f Daily bump. 2021-10-19 00:16:23 +00:00
Tobias Burnus 64f9623765 Fortran: Fix Bind(C) Array-Descriptor Conversion
gfortran uses internally a different array descriptor ("gfc") as
Fortran 2018 alias TS291113 defines for C interoperability via
ISO_Fortran_binding.h ("CFI").  Hence, when calling a C function
from Fortran, it has to be converted in the callee - and if a
BIND(C) procedure is written in Fortran, the CFI argument has
to be converted to gfc in order work with the rest of the FE
code and the library calls.

Before this patch, part was handled in the FE generated code and
other parts in libgfortran.  With this patch, all code is generated
and CFI is defined as proper type - visible in the debugger and to
the middle end - avoiding both alias issues and missed optimization
issues.

This patch also fixes issues like: intent(out) deallocation in
the bind(C) callee, using the CFI descriptor also for allocatable
and pointer scalars and for len=* character strings.
For 'select rank', it also optimizes the code + avoid accessing
uninitialized memory if the dummy argument is allocatable/a pointer.
It additionally rejects passing a descriptorless type(*) to an
assumed-rank dummy argument. [F2018:C711]

	PR fortran/102086
	PR fortran/92189
	PR fortran/92621
	PR fortran/101308
	PR fortran/101309
	PR fortran/101635
	PR fortran/92482

gcc/fortran/ChangeLog:

	* decl.c (gfc_verify_c_interop_param): Remove 'sorry' for
	scalar allocatable/pointer and len=*.
	* expr.c (is_CFI_desc): Return true for for those.
	* gfortran.h (CFI_type_kind_shift, CFI_type_mask,
	CFI_type_from_type_kind, CFI_VERSION, CFI_MAX_RANK,
	CFI_attribute_pointer, CFI_attribute_allocatable,
	CFI_attribute_other, CFI_type_Integer, CFI_type_Logical,
	CFI_type_Real, CFI_type_Complex, CFI_type_Character,
	CFI_type_ucs4_char, CFI_type_struct, CFI_type_cptr,
	CFI_type_cfunptr, CFI_type_other): New #define.
	* trans-array.c (CFI_FIELD_BASE_ADDR, CFI_FIELD_ELEM_LEN,
	CFI_FIELD_VERSION, CFI_FIELD_RANK, CFI_FIELD_ATTRIBUTE,
	CFI_FIELD_TYPE, CFI_FIELD_DIM, CFI_DIM_FIELD_LOWER_BOUND,
	CFI_DIM_FIELD_EXTENT, CFI_DIM_FIELD_SM,
	gfc_get_cfi_descriptor_field, gfc_get_cfi_desc_base_addr,
	gfc_get_cfi_desc_elem_len, gfc_get_cfi_desc_version,
	gfc_get_cfi_desc_rank, gfc_get_cfi_desc_type,
	gfc_get_cfi_desc_attribute, gfc_get_cfi_dim_item,
	gfc_get_cfi_dim_lbound, gfc_get_cfi_dim_extent, gfc_get_cfi_dim_sm):
	New define/functions to access the CFI array descriptor.
	(gfc_conv_descriptor_type): New function for the GFC descriptor.
	(gfc_get_array_span): Handle expr of CFI descriptors and
	assumed-type descriptors.
	(gfc_trans_array_bounds): Remove 'static'.
	(gfc_conv_expr_descriptor): For assumed type, use the dtype of
	the actual argument.
	(structure_alloc_comps): Remove ' ' inside tabs.
	* trans-array.h (gfc_trans_array_bounds, gfc_conv_descriptor_type,
	gfc_get_cfi_desc_base_addr, gfc_get_cfi_desc_elem_len,
	gfc_get_cfi_desc_version, gfc_get_cfi_desc_rank,
	gfc_get_cfi_desc_type, gfc_get_cfi_desc_attribute,
	gfc_get_cfi_dim_lbound, gfc_get_cfi_dim_extent, gfc_get_cfi_dim_sm):
	New prototypes.
	* trans-decl.c (gfor_fndecl_cfi_to_gfc, gfor_fndecl_gfc_to_cfi):
	Remove global vars.
	(gfc_build_builtin_function_decls): Remove their initialization.
	(gfc_get_symbol_decl, create_function_arglist,
	gfc_trans_deferred_vars): Update for CFI.
	(convert_CFI_desc): Remove and replace by ...
	(gfc_conv_cfi_to_gfc): ... this function
	(gfc_generate_function_code): Call it; create local GFC var for CFI.
	* trans-expr.c (gfc_maybe_dereference_var): Handle CFI.
	(gfc_conv_subref_array_arg): Handle the if-noncontigous-only copy in
	when the result should be a descriptor.
	(gfc_conv_gfc_desc_to_cfi_desc): Completely rewritten.
	(gfc_conv_procedure_call): CFI fixes.
	* trans-openmp.c (gfc_omp_is_optional_argument,
	gfc_omp_check_optional_argument): Handle optional
	CFI.
	* trans-stmt.c (gfc_trans_select_rank_cases): Cleanup, avoid invalid
	code for allocatable/pointer dummies, which cannot be assumed size.
	* trans-types.c (gfc_cfi_descriptor_base): New global var.
	(gfc_get_dtype_rank_type): Skip rank init for rank < 0.
	(gfc_sym_type): Handle CFI dummies.
	(gfc_get_function_type): Update call.
	(gfc_get_cfi_dim_type, gfc_get_cfi_type): New.
	* trans-types.h (gfc_sym_type): Update prototype.
	(gfc_get_cfi_type): New prototype.
	* trans.c (gfc_trans_runtime_check): Make conditions more consistent
	to avoid '<logical> AND_THEN <long int>' in conditions.
	* trans.h (gfor_fndecl_cfi_to_gfc, gfor_fndecl_gfc_to_cfi): Remove
	global-var declaration.

libgfortran/ChangeLog:

	* ISO_Fortran_binding.h (CFI_type_cfunptr): Make unique type again.
	* runtime/ISO_Fortran_binding.c (cfi_desc_to_gfc_desc,
	gfc_desc_to_cfi_desc): Add comment that those are no longer called
	by new code.

libgomp/ChangeLog:

	* testsuite/libgomp.fortran/optional-bind-c.f90: New test.

gcc/testsuite/ChangeLog:

	* gfortran.dg/ISO_Fortran_binding_4.f90: Extend testcase.
	* gfortran.dg/PR100914.f90: Remove xfail.
	* gfortran.dg/PR100915.c: Expect CFI_type_cfunptr.
	* gfortran.dg/PR100915.f90: Handle CFI_type_cfunptr != CFI_type_cptr.
	* gfortran.dg/PR93963.f90: Extend select-rank tests.
	* gfortran.dg/bind-c-intent-out.f90: Change to dg-do run,
	update scan-dump.
	* gfortran.dg/bind_c_array_params_2.f90: Update/extend scan-dump.
	* gfortran.dg/bind_c_char_10.f90: Update scan-dump.
	* gfortran.dg/bind_c_char_8.f90: Remove dg-error "sorry".
	* gfortran.dg/c-interop/allocatable-dummy.f90: Remove xfail.
	* gfortran.dg/c-interop/c1255-1.f90: Likewise.
	* gfortran.dg/c-interop/c407c-1.f90: Update dg-error.
	* gfortran.dg/c-interop/cf-descriptor-5.f90: Remove xfail.
	* gfortran.dg/c-interop/cf-out-descriptor-3.f90: Likewise.
	* gfortran.dg/c-interop/cf-out-descriptor-4.f90: Likewise.
	* gfortran.dg/c-interop/cf-out-descriptor-5.f90: Likewise.
	* gfortran.dg/c-interop/contiguous-2.f90: Likewise.
	* gfortran.dg/c-interop/contiguous-3.f90: Likewise.
	* gfortran.dg/c-interop/deferred-character-1.f90: Likewise.
	* gfortran.dg/c-interop/deferred-character-2.f90: Likewise.
	* gfortran.dg/c-interop/fc-descriptor-3.f90: Likewise.
	* gfortran.dg/c-interop/fc-descriptor-5.f90: Likewise.
	* gfortran.dg/c-interop/fc-descriptor-6.f90: Likewise.
	* gfortran.dg/c-interop/fc-out-descriptor-3.f90: Likewise.
	* gfortran.dg/c-interop/fc-out-descriptor-4.f90: Likewise.
	* gfortran.dg/c-interop/fc-out-descriptor-5.f90: Likewise.
	* gfortran.dg/c-interop/fc-out-descriptor-6.f90: Likewise.
	* gfortran.dg/c-interop/ff-descriptor-5.f90: Likewise.
	* gfortran.dg/c-interop/ff-descriptor-6.f90: Likewise.
	* gfortran.dg/c-interop/fc-descriptor-7.f90: Remove xfail + extend.
	* gfortran.dg/c-interop/fc-descriptor-7-c.c: Update for changes.
	* gfortran.dg/c-interop/shape.f90: Add implicit none.
	* gfortran.dg/c-interop/typecodes-array-char-c.c: Add kind=4 char.
	* gfortran.dg/c-interop/typecodes-array-char.f90: Likewise.
	* gfortran.dg/c-interop/typecodes-array-float128.f90: Remove xfail.
	* gfortran.dg/c-interop/typecodes-scalar-basic.f90: Likewise.
	* gfortran.dg/c-interop/typecodes-scalar-float128.f90: Likewise.
	* gfortran.dg/c-interop/typecodes-scalar-int128.f90: Likewise.
	* gfortran.dg/c-interop/typecodes-scalar-longdouble.f90: Likewise.
	* gfortran.dg/iso_c_binding_char_1.f90: Remove dg-error "sorry".
	* gfortran.dg/pr93792.f90: Turn XFAIL into PASS.
	* gfortran.dg/ISO_Fortran_binding_19.f90: New test.
	* gfortran.dg/assumed_type_12.f90: New test.
	* gfortran.dg/assumed_type_13.c: New test.
	* gfortran.dg/assumed_type_13.f90: New test.
	* gfortran.dg/bind-c-char-descr.f90: New test.
	* gfortran.dg/bind-c-contiguous-1.c: New test.
	* gfortran.dg/bind-c-contiguous-1.f90: New test.
	* gfortran.dg/bind-c-contiguous-2.f90: New test.
	* gfortran.dg/bind-c-contiguous-3.c: New test.
	* gfortran.dg/bind-c-contiguous-3.f90: New test.
	* gfortran.dg/bind-c-contiguous-4.c: New test.
	* gfortran.dg/bind-c-contiguous-4.f90: New test.
	* gfortran.dg/bind-c-contiguous-5.c: New test.
	* gfortran.dg/bind-c-contiguous-5.f90: New test.
2021-10-18 10:29:30 +02:00
GCC Administrator cf966403d9 Daily bump. 2021-09-28 00:16:21 +00:00
Tobias Burnus 00f6de9c69 Fortran: Fix assumed-size to assumed-rank passing [PR94070]
This code inlines the size0 and size1 libgfortran calls, the former is still
used by libgfortan itself (and by old code). Besides permitting more
optimizations, it also permits to handle assumed-rank dummies better: If the
dummy argument is a nonpointer/nonallocatable, an assumed-size actual arg is
repesented by having ubound == -1 for the last dimension. However, for
allocatable/pointers, this value can also exist. Hence, the dummy arg attr
has to be honored.

For that reason, when calling an assumed-rank procedure with nonpointer,
nonallocatable dummy arguments, the bounds have to be updated to avoid
the case ubound == -1 for the last dimension.

	PR fortran/94070

gcc/fortran/ChangeLog:

	* trans-array.c (gfc_tree_array_size): New function to
	find size inline (whole array or one dimension).
	(array_parameter_size): Use it, take stmt_block as arg.
	(gfc_conv_array_parameter): Update call.
	* trans-array.h (gfc_tree_array_size): Add prototype.
	* trans-decl.c (gfor_fndecl_size0, gfor_fndecl_size1): Remove
	these global vars.
	(gfc_build_intrinsic_function_decls): Remove their initialization.
	* trans-expr.c (gfc_conv_procedure_call): Update
	bounds of pointer/allocatable actual args to nonallocatable/nonpointer
	dummies to be one based.
	* trans-intrinsic.c (gfc_conv_intrinsic_shape): Fix case for
	assumed rank with allocatable/pointer dummy.
	(gfc_conv_intrinsic_size): Update to use inline function.
	* trans.h (gfor_fndecl_size0, gfor_fndecl_size1): Remove var decl.

libgfortran/ChangeLog:

	* intrinsics/size.c (size0, size1): Comment that now not
	used by newer compiler code.

libgomp/ChangeLog:

	* testsuite/libgomp.oacc-fortran/privatized-ref-2.f90: Update
	expected dg-note output.

gcc/testsuite/ChangeLog:

	* gfortran.dg/c-interop/cf-out-descriptor-6.f90: Remove xfail.
	* gfortran.dg/c-interop/size.f90: Remove xfail.
	* gfortran.dg/intrinsic_size_3.f90: Update scan-tree-dump-times.
	* gfortran.dg/transpose_optimization_2.f90: Likewise.
	* gfortran.dg/size_optional_dim_1.f90: Add scan-tree-dump-not.
	* gfortran.dg/assumed_rank_22.f90: New test.
	* gfortran.dg/assumed_rank_22_aux.c: New test.
2021-09-27 14:04:54 +02:00
GCC Administrator 1932e1169a Daily bump. 2021-09-27 00:16:16 +00:00
Tobias Burnus fe2771b291 Fortran: Fix associated intrinsic with assumed rank [PR101334]
ASSOCIATE (ptr, tgt) takes as first argument also an assumed-rank array;
however, using it together with a tgt (required to be non assumed rank)
had issues for both scalar and nonscalar tgt.

	PR fortran/101334
gcc/fortran/ChangeLog:

	* trans-intrinsic.c (gfc_conv_associated): Support assumed-rank
	'pointer' with scalar/array 'target' argument.

libgfortran/ChangeLog:

	* intrinsics/associated.c (associated): Also check for same rank.

gcc/testsuite/ChangeLog:

	* gfortran.dg/associated_assumed_rank.f90: New test.
2021-09-26 19:26:01 +02:00
GCC Administrator e4777439fc Daily bump. 2021-09-23 00:16:29 +00:00
Tobias Burnus 83aac69883 Fortran: Improve -Wmissing-include-dirs warnings [PR55534]
It turned out that enabling the -Wmissing-include-dirs for libcpp did output
too many warnings – at least as run with -B and similar options during the
GCC build and warning for internal include dirs like finclude, unlikely of
relevance to for a real-world user.
This patch now only warns for -I and -J by default but permits to get the
full warnings including libcpp ones with -Wmissing-include-dirs. It
additionally documents this in the manual.

With that change, the -Wno-missing-include-dirs could be removed
from libgfortran's configure and libgomp's testsuite always cflags.
This reverts those bits of the previous
commit r12-3722-g417ea5c02cef7f000e66d1af22b066c2c1cda047

Additionally, it turned out that all call to load_file called exit
explicitly - except for the main file via gfc_init -> gfc_new_file. The
latter also output a file not existing fatal error, such that two errors
where printed. Now exit is called in line with the other users of
load_file.

Finally, when compileing with "nonexisting/file.f90", first a warning that
"nonexisting" does not exist as include path was printed before the file
not found error was printed. Now the directory in which the physical file
is located is added silently, relying on the file-not-found diagnostic for
those.

	PR fortran/55534
gcc/ChangeLog:

	* doc/invoke.texi (-Wno-missing-include-dirs.): Document Fortran
	behavior.

gcc/fortran/ChangeLog:

	* cpp.c (gfc_cpp_register_include_paths, gfc_cpp_post_options):
	Add new bool verbose_missing_dir_warn argument.
	* cpp.h (gfc_cpp_post_options): Update prototype.
	* f95-lang.c (gfc_init): Remove duplicated file-not found diag.
	* gfortran.h (gfc_check_include_dirs): Takes bool
	verbose_missing_dir_warn arg.
	(gfc_new_file): Returns now void.
	* options.c (gfc_post_options): Update to warn for -I and -J,
	only, by default but for all when user requested.
	* scanner.c (gfc_do_check_include_dir):
	(gfc_do_check_include_dirs, gfc_check_include_dirs): Take bool
	verbose warn arg and update to avoid printing the same message
	twice or never.
	(load_file): Fix indent.
	(gfc_new_file): Return void and exit when load_file failed
	as all other load_file users do.

libgfortran/ChangeLog:

	* configure.ac (AM_FCFLAGS): Revert r12-3722 by removing
	-Wno-missing-include-dirs.
	* configure: Regenerate.

libgomp/ChangeLog:

	* testsuite/libgomp.fortran/fortran.exp (ALWAYS_CFLAGS): Revert
	r12-3722 by removing -Wno-missing-include-dirs.
	* testsuite/libgomp.oacc-fortran/fortran.exp (ALWAYS_CFLAGS): Likewise.

gcc/testsuite/ChangeLog:

	* gfortran.dg/include_14.f90: Add -J testcase and update dg-output.
	* gfortran.dg/include_15.f90: Likewise.
	* gfortran.dg/include_16.f90: Likewise.
	* gfortran.dg/include_17.f90: Likewise.
	* gfortran.dg/include_18.f90: Likewise.
	* gfortran.dg/include_19.f90: Likewise.
2021-09-22 20:58:35 +02:00
GCC Administrator 2c41dd82e2 Daily bump. 2021-09-22 00:16:28 +00:00
Tobias Burnus 417ea5c02c Fortran: Fix -Wno-missing-include-dirs handling [PR55534]
gcc/fortran/ChangeLog:

	PR fortran/55534
	* cpp.c: Define GCC_C_COMMON_C for #include "options.h" to make
	cpp_reason_option_codes available.
	(gfc_cpp_register_include_paths): Make static, set pfile's
	warn_missing_include_dirs and move before caller.
	(gfc_cpp_init_cb): New, cb code moved from ...
	(gfc_cpp_init_0): ... here.
	(gfc_cpp_post_options): Call gfc_cpp_init_cb.
	(cb_cpp_diagnostic_cpp_option): New. As implemented in c-family
	to match CppReason flags to -W... names.
	(cb_cpp_diagnostic): Use it to replace single special case.
	* cpp.h (gfc_cpp_register_include_paths): Remove as now static.
	* gfortran.h (gfc_check_include_dirs): New prototype.
	(gfc_add_include_path): Add new bool arg.
	* options.c (gfc_init_options): Don't set -Wmissing-include-dirs.
	(gfc_post_options): Set it here after commandline processing. Call
	gfc_add_include_path with defer_warn=false.
	(gfc_handle_option): Call it with defer_warn=true.
	* scanner.c (gfc_do_check_include_dir, gfc_do_check_include_dirs,
	gfc_check_include_dirs): New. Diagnostic moved from ...
	(add_path_to_list): ... here, which came before cmdline processing.
	Take additional bool defer_warn argument.
	(gfc_add_include_path): Take additional defer_warn arg.
	* scanner.h (struct gfc_directorylist): Reorder for alignment issues,
	add new 'bool warn'.

libgfortran/ChangeLog:
	PR fortran/55534
	* configure.ac (AM_FCFLAGS): Add -Wno-missing-include-dirs.
	* configure: Regenerate.

libgomp/ChangeLog:
	PR fortran/55534
	* testsuite/libgomp.fortran/fortran.exp: Add -Wno-missing-include-dirs
	to ALWAYS_CFLAGS.
	* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.

gcc/testsuite/ChangeLog:
	* gfortran.dg/include_6.f90: Change dg-error to
	dg-warning and update pattern.
	* gfortran.dg/include_14.f90: New test.
	* gfortran.dg/include_15.f90: New test.
	* gfortran.dg/include_16.f90: New test.
	* gfortran.dg/include_17.f90: New test.
	* gfortran.dg/include_18.f90: New test.
	* gfortran.dg/include_19.f90: New test.
	* gfortran.dg/include_20.f90: New test.
	* gfortran.dg/include_21.f90: New test.
2021-09-21 08:28:30 +02:00
GCC Administrator 0a4cb43932 Daily bump. 2021-09-18 00:16:36 +00:00
Sandra Loosemore 00b1324f92 Fortran: Use _Float128 rather than __float128 for c_float128 kind.
The GNU Fortran manual documents that the c_float128 kind corresponds
to __float128, but in fact the implementation uses float128_type_node,
which is _Float128.  Both refer to the 128-bit IEEE/ISO encoding, but
some targets including aarch64 only define _Float128 and not __float128,
and do not provide quadmath.h.  This caused errors in some test cases
referring to __float128.

This patch changes the documentation (including code comments) and
test cases to use _Float128 to match the implementation.

2021-09-16  Sandra Loosemore  <sandra@codesourcery.com>

gcc/fortran/

	* intrinsic.texi (ISO_C_BINDING): Change C_FLOAT128 to correspond
	to _Float128 rather than __float128.
	* iso-c-binding.def (c_float128): Update comments.
	* trans-intrinsic.c (gfc_builtin_decl_for_float_kind): Likewise.
	(build_round_expr): Likewise.
	(gfc_build_intrinsic_lib_fndcecls): Likewise.
	* trans-types.h (gfc_real16_is_float128): Likewise.

gcc/testsuite/
	* gfortran.dg/PR100914.c: Do not include quadmath.h.  Use
	_Float128 _Complex instead of __complex128.
	* gfortran.dg/PR100914.f90: Add -Wno-pedantic to suppress error
	about use of _Float128.
	* gfortran.dg/c-interop/typecodes-array-float128-c.c: Use
	_Float128 instead of __float128.
	* gfortran.dg/c-interop/typecodes-sanity-c.c: Likewise.
	* gfortran.dg/c-interop/typecodes-scalar-float128-c.c: Likewise.
	* lib/target-supports.exp
	(check_effective_target_fortran_real_c_float128): Update comments.

libgfortran/
	* ISO_Fortran_binding.h: Update comments.
	* runtime/ISO_Fortran_binding.c: Likewise.
2021-09-17 08:20:51 -07:00
Tobias Burnus 654187d053 Fortran: Prefer GCC internal macros to float.h in ISO_Fortran_binding.h.
2021-09-17  Sandra Loosemore  <sandra@codesourcery.com>
	    Tobias Burnus  <tobias@codesourcery.com>

libgfortran/
	* ISO_Fortran_binding.h: Only include float.h if the C compiler
	doesn't have predefined __LDBL_* and __DBL_* macros. Handle
	LDBL_MANT_DIG == 53 for FreeBSD.
2021-09-17 15:43:30 +02:00
GCC Administrator 07985c47dc Daily bump. 2021-09-14 00:16:23 +00:00
Andreas Schwab fc4a29c078 libgfortran: Handle m68k extended real format in ISO_Fortran_binding.h
libgfortran/
	* ISO_Fortran_binding.h (CFI_type_long_double)
	(CFI_type_long_double_Complex) [LDBL_MANT_DIG == 64 &&
	LDBL_MIN_EXP == -16382 && LDBL_MAX_EXP == 16384]: Define.
2021-09-13 10:04:01 +02:00
GCC Administrator b2748138c0 Daily bump. 2021-09-08 00:16:23 +00:00
Tobias Burnus fc4f0631de libgfortran: Makefile fix for ISO_Fortran_binding.h
libgfortran/ChangeLog:

	* Makefile.am (gfor_built_src): Depend on
	include/ISO_Fortran_binding.h not on ISO_Fortran_binding.h.
	(ISO_Fortran_binding.h): Rename make target to ...
	(include/ISO_Fortran_binding.h): ... this.
	* Makefile.in: Regenerate.
2021-09-07 17:46:05 +02:00
Sandra Loosemore 13beaf9e8d Fortran: Revert to non-multilib-specific ISO_Fortran_binding.h
Commit fef67987cf changed the
libgfortran build process to generate multilib-specific versions of
ISO_Fortran_binding.h from a template, by running gfortran to identify
the values of the Fortran kind constants C_LONG_DOUBLE, C_FLOAT128,
and C_INT128_T.  This caused multiple problems with search paths, both
for build-tree testing and installed-tree use, not all of which have
been fixed.

This patch reverts to a non-multilib-specific .h file that uses GCC's
predefined preprocessor symbols to detect the supported types and map
them to kind values in the same way as the Fortran front end.

2021-09-06  Sandra Loosemore  <sandra@codesourcery.com>

libgfortran/
	* ISO_Fortran_binding-1-tmpl.h: Deleted.
	* ISO_Fortran_binding-2-tmpl.h: Deleted.
	* ISO_Fortran_binding-3-tmpl.h: Deleted.
	* ISO_Fortran_binding.h: New file to replace the above.
	* Makefile.am (gfor_cdir): Remove MULTISUBDIR.
	(ISO_Fortran_binding.h): Simplify to just copy the file.
	* Makefile.in: Regenerated.
	* mk-kinds-h.sh: Revert pieces no longer needed for
	ISO_Fortran_binding.h.
2021-09-06 21:28:50 -07:00
GCC Administrator 9f7c2bad52 Daily bump. 2021-09-03 00:16:33 +00:00
Sandra Loosemore 93b6b2f614 libgfortran: Further fixes for GFC/CFI descriptor conversions.
This patch is for:
PR100907 - Bind(c): failure handling wide character
PR100911 - Bind(c): failure handling C_PTR
PR100914 - Bind(c): errors handling complex
PR100915 - Bind(c): failure handling C_FUNPTR
PR100917 - Bind(c): errors handling long double real

All of these problems are related to the GFC descriptors constructed
by the Fortran front end containing ambigous or incomplete
information.  This patch does not attempt to change the GFC data
structure or the front end, and only makes the runtime interpret it in
more reasonable ways.  It's not a complete fix for any of the listed
issues.

The Fortran front end does not distinguish between C_PTR and
C_FUNPTR, mapping both onto BT_VOID.  That is what this patch does also.

The other bugs are related to GFC descriptors only containing elem_len
and not kind.  For complex types, the elem_len needs to be divided by
2 and then mapped onto a real kind.  On x86 targets, the kind
corresponding to C long double is different than its elem_len; since
we cannot accurately disambiguate between a 16-byte kind 10 long
double from __float128, this patch arbitrarily prefers to interpret that as
the standard long double type rather than the GNU extension.

Similarly, for character types, the GFC descriptor cannot distinguish
between character(kind=c_char, len=4) and character(kind=ucs4, len=1).
But since the front end currently rejects anything other than len=1
(PR92482) this patch uses the latter interpretation.

2021-09-01  Sandra Loosemore  <sandra@codesourcery.com>
	    José Rui Faustino de Sousa  <jrfsousa@gmail.com>

gcc/testsuite/
	PR fortran/100911
	PR fortran/100915
	PR fortran/100916
	* gfortran.dg/PR100911.c: New file.
	* gfortran.dg/PR100911.f90: New file.
	* gfortran.dg/PR100914.c: New file.
	* gfortran.dg/PR100914.f90: New file.
	* gfortran.dg/PR100915.c: New file.
	* gfortran.dg/PR100915.f90: New file.

libgfortran/
	PR fortran/100907
	PR fortran/100911
	PR fortran/100914
	PR fortran/100915
	PR fortran/100917
	* ISO_Fortran_binding-1-tmpl.h (CFI_type_cfunptr): Make equivalent
	to CFI_type_cptr.
	* runtime/ISO_Fortran_binding.c (cfi_desc_to_gfc_desc): Fix
	handling of CFI_type_cptr and CFI_type_cfunptr.  Additional error
	checking and code cleanup.
	(gfc_desc_to_cfi_desc): Likewise.  Also correct kind mapping
	for character, complex, and long double types.
2021-09-02 16:41:02 -07:00
GCC Administrator 1e52538d2b Daily bump. 2021-08-28 00:16:42 +00:00
Iain Sandoe 9b025925ec libgfortran: Use the libtool macro to determine libm availability.
We recently had a report of build failure against a Darwin branch on
the latest OS release.  This was because (temporarily) the symlink
from libm.dylib => libSystem.dylib had been removed/omitted.

libm is not needed on Darwin, and should not be added unconditionally
even if that is (mostly) harmless since it is a symlink to libc.

There could be cases where the addition was not completely harmless
because the presentation of the symlink would cause the symbols exposed
in libSystem to be considered ahead of ones presented in convenience
libraries.

libgfortran/ChangeLog:

	* Makefile.am: Use configured libm availability.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Use libtool macro to find libm availability.
	* libgfortran.spec.in: Use configured libm availability.
2021-08-27 16:50:19 +01:00
GCC Administrator 3ae564ea74 Daily bump. 2021-08-11 00:16:27 +00:00
Tobias Burnus 2ba0376ac4 gfortran: Fix in-build-tree testing [PR101305, PR101660]
ISO_Fortran_binding.h is written in the build dir - hence, a previous commit
added it as include directory for in-build-tree testing.  However,
it turned out that -I$specdir/libgfortran interferes with reading .mod files
as they are then no longer regareded as intrinsic modules.  Solution: Create
an extra include/ directory in the libgfortran build dir and copy
ISO_Fortran_binding.h to that directory.  As -B$specdir/libgfortran already
causes gfortran to read that include subdirectory, the -I flag is no longer
needed.

	PR libfortran/101305
	PR fortran/101660
	PR testsuite/101847

libgfortran/ChangeLog:

	* Makefile.am (ISO_Fortran_binding.h): Create include/ in the build dir
	and copy the include file to it.
	(clean-local): Add for removing the 'include' directory.
	* Makefile.in: Regenerate.

gcc/testsuite/ChangeLog:

	* lib/gfortran.exp (gfortran_init): Remove -I$specpath/libgfortran
	from the string used to set GFORTRAN_UNDER_TEST.
2021-08-10 17:26:32 +02:00
GCC Administrator 3916902930 Daily bump. 2021-07-29 00:16:43 +00:00
Sandra Loosemore e78480ad09 Bind(c): Improve error checking in CFI_* functions
This patch adds additional run-time checking for invalid arguments to
CFI_establish and CFI_setpointer.  It also changes existing messages
throughout the CFI_* functions to use PRIiPTR to format CFI_index_t
values instead of casting them to int and using %d (which may not work
on targets where int is a smaller type), simplifies wording of some
messages, and fixes issues with capitalization, typos, and the like.
Additionally some coding standards problems such as >80 character lines
are addressed.

2021-07-24  Sandra Loosemore  <sandra@codesourcery.com>

	PR libfortran/101317

libgfortran/
	* runtime/ISO_Fortran_binding.c: Include <inttypes.h>.
	(CFI_address): Tidy error messages and comments.
	(CFI_allocate): Likewise.
	(CFI_deallocate): Likewise.
	(CFI_establish): Likewise.  Add new checks for validity of
	elem_len when it's used, plus type argument and extents.
	(CFI_is_contiguous): Tidy error messages and comments.
	(CFI_section): Likewise.  Refactor some repetitive code to
	make it more understandable.
	(CFI_select_part): Likewise.
	(CFI_setpointer): Likewise.  Check that source is not an
	unallocated allocatable array or an assumed-size array.

gcc/testsuite/
	* gfortran.dg/ISO_Fortran_binding_17.f90: Fix typo in error
	message patterns.
2021-07-27 21:24:26 -07:00