public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/101827] New: Wrong stringop-overflow warning
@ 2021-08-09  9:52 jellby at yahoo dot com
  2021-08-09 12:53 ` [Bug fortran/101827] " rguenth at gcc dot gnu.org
  2021-08-09 14:18 ` jellby at yahoo dot com
  0 siblings, 2 replies; 3+ messages in thread
From: jellby at yahoo dot com @ 2021-08-09  9:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101827

            Bug ID: 101827
           Summary: Wrong stringop-overflow warning
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jellby at yahoo dot com
  Target Milestone: ---

When trying to compile OpenMolcas with gcc 10.1 and link-time optimization I
get:

../src/slapaf_util/outofplane_list.f: In function ‘outofplane_list’:            
../src/slapaf_util/outofplane_list.f:524: error: writing 1 byte into a region
of size 0 [-Werror=stringop-overflow=]
  524 |                      Lbls(3)(iE3+1:iE3+1)='('                           
      |                                                                         
../src/slapaf_util/outofplane_list.f:45:32: note: at offset 0 to object ‘lbls’
with size 40 declared here
   45 |       Character*(LENIN4) Lbls(4)                                        
      |                                ^                                        
[...]
lto1: all warnings being treated as errors                                      
lto-wrapper: fatal error: /usr/bin/gfortran returned 1 exit status              


How is "Lbls(3)(iE3+1:iE3+1)" a region of size 0? Similar constructs elsewhere
don't raise the flag. Does the compiler believe "iE3+1" is beyond the length of
the string? But then it says nothing without -flto.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug fortran/101827] Wrong stringop-overflow warning
  2021-08-09  9:52 [Bug fortran/101827] New: Wrong stringop-overflow warning jellby at yahoo dot com
@ 2021-08-09 12:53 ` rguenth at gcc dot gnu.org
  2021-08-09 14:18 ` jellby at yahoo dot com
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-08-09 12:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101827

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
                 CC|                            |msebor at gcc dot gnu.org

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Can you attach a TU where this issue shows?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug fortran/101827] Wrong stringop-overflow warning
  2021-08-09  9:52 [Bug fortran/101827] New: Wrong stringop-overflow warning jellby at yahoo dot com
  2021-08-09 12:53 ` [Bug fortran/101827] " rguenth at gcc dot gnu.org
@ 2021-08-09 14:18 ` jellby at yahoo dot com
  1 sibling, 0 replies; 3+ messages in thread
From: jellby at yahoo dot com @ 2021-08-09 14:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101827

--- Comment #2 from Ignacio Fernández Galván <jellby at yahoo dot com> ---
What's a TU? I didn't succeed (but didn't try to hard) in creating a minimal
test case. But this reproduces the problem:

$ git clone -b ipo https://gitlab.com/Molcas/OpenMolcas.git
$ cd OpenMolcas
$ git submodule update --init External/lapack

# (comment out the line in src/gateway_util/Symmetry_Info.f90
#  that refers to this report, i.e. search for 101827.
#  But note that the "ipo" branch is in development and will change.)

$ mkdir build
$ cd build
$ cmake -D BUILD_SHARED_LIBS=ON -D BIGOT=ON ..
$ make
[...]
[ 65%] Linking Fortran shared library lib/libmolcas.so
In function ‘chtab’,
    inlined from ‘__symmetry_info_MOD_symmetry_info_setup.part.0’ at
/OpenMolcas/src/gateway_util/Symmetry_Info.f90:335:0:
/OpenMolcas/src/gateway_util/Symmetry_Info.f90:655: error: writing 1 byte into
a region of size 0 [-Werror=stringop-overflow=]
  655 |                 lIrrep(iIrrep-1)(i1:i1)='u'
      | 
/OpenMolcas/src/gateway_util/Symmetry_Info.f90: In function
‘__symmetry_info_MOD_symmetry_info_setup.part.0’:
/OpenMolcas/src/gateway_util/Symmetry_Info.f90:17:60: note: at offset 0 to
object ‘lirrep’ with size 24 declared here
   17 | Public :: nIrrep, iOper, iChTbl, iChCar, Mul, iChBas, lIrrep, lBsFnc,
SymLab, iSkip, &
      |                                                            ^
In function ‘chtab’,
    inlined from ‘__symmetry_info_MOD_symmetry_info_setup.part.0’ at
/OpenMolcas/src/gateway_util/Symmetry_Info.f90:335:0:
/OpenMolcas/src/gateway_util/Symmetry_Info.f90:653: error: writing 1 byte into
a region of size 0 [-Werror=stringop-overflow=]
  653 |                lIrrep(iIrrep-1)(i1:i1)='g'
      | 
/OpenMolcas/src/gateway_util/Symmetry_Info.f90: In function
‘__symmetry_info_MOD_symmetry_info_setup.part.0’:
/OpenMolcas/src/gateway_util/Symmetry_Info.f90:17:60: note: at offset 0 to
object ‘lirrep’ with size 24 declared here
   17 | Public :: nIrrep, iOper, iChTbl, iChCar, Mul, iChBas, lIrrep, lBsFnc,
SymLab, iSkip, &
      |                                                            ^
lto1: all warnings being treated as errors
lto-wrapper: fatal error: /usr/bin/gfortran returned 1 exit status

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-09 14:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-09  9:52 [Bug fortran/101827] New: Wrong stringop-overflow warning jellby at yahoo dot com
2021-08-09 12:53 ` [Bug fortran/101827] " rguenth at gcc dot gnu.org
2021-08-09 14:18 ` jellby at yahoo dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).