[Bug fortran/107695] New: Non conforming shape during assignment is not detected at run-time

2022-11-15 Thread Edouard.Canot--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107695

Bug ID: 107695
   Summary: Non conforming shape during assignment is not detected
at run-time
   Product: gcc
   Version: 12.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: edouard.ca...@univ-rennes1.fr
  Target Milestone: ---

Created attachment 53900
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53900&action=edit
Fortran test program which reveals the bug

At run-time, the attached program leads to memory problems (only detected by
valgrind).

It is compiled by the following command:
  $ gfortran -fbounds-check -g -o test test.f90

The bug occurs at least for GCC versions from 8.5 to 12.2

In the following assignment:
  z(ind,ind) = data(:,:)
I thought that data is recognized as a scalar (shape is [1,1]) and its value
spread to the four elements of z. This is not the case.

However:
  z(ind,ind) = data(1,1)
gives the correct result as expected.

Of course, the problem cannot be detected at compile-time since both 'z' and
'data' arrays are allocatable.

[Bug fortran/117840] New: backslash at the end of a commented line, in files that need to be preprocessed

2024-11-28 Thread Edouard.Canot--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117840

Bug ID: 117840
   Summary: backslash at the end of a commented line, in files
that need to be preprocessed
   Product: gcc
   Version: 14.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: edouard.ca...@univ-rennes1.fr
  Target Milestone: ---

Only for files which have the .F90 extension (that is, a file that needs to be
preprocessed), the "bang" character doesn't seem to protect to the
interpretation of the comment.

To give two examples:

1) a backslash at the end of a commented line suppresses the next line, which
can lead to a compile error if the removed line is a valid Fortran statement.

   program first
   ! this is a commented line, which have a backslash at its end \
  integer, parameter :: n = 2
  integer :: array(n)
   end program

2) an opening C-comment ("/*") inside everywhere is a commented line leads to a
compile error, if it is not closed in the same line.

   program essai
   ! from ... /* beginning of a C-comment
   end program

---

Both bugs arise in versions 10.5 to 14.2 (at least)