[Bug fortran/47485] gfortran -M output is incorrect when -MT option is used

2023-04-27 Thread volker.weissmann at gmx dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485

Volker Weißmann  changed:

   What|Removed |Added

 CC||volker.weissmann at gmx dot de

--- Comment #6 from Volker Weißmann  ---
Still present in gcc 12.2.1

This bug still creates problems for meson's fortran support.

Please fix.

[Bug fortran/109211] New: f951: internal compiler error: in gfc_current_interface_head

2023-03-20 Thread volker.weissmann at gmx dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109211

Bug ID: 109211
   Summary: f951: internal compiler error: in
gfc_current_interface_head
   Product: gcc
   Version: 12.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: volker.weissmann at gmx dot de
  Target Milestone: ---

My compiler told me to submit a bug report, so here I go:

$ cat bug.f90
module child
contains
module procedure childprod
print *,123
end procedure childprod
end submodule child
$ gfortran -freport-bug -c bug.f90
f951: internal compiler error: in gfc_current_interface_head, at
fortran/interface.cc:4890
0x193c404 internal_error(char const*, ...)
???:0
0x644496 fancy_abort(char const*, int, char const*)
???:0
0x68894d gfc_match_modproc()
???:0
0x734ef4 gfc_parse_file()
???:0
Please submit a full bug report, with preprocessed source.
Please include the complete backtrace with any bug report.
See <https://bugs.archlinux.org/> for instructions.

[Bug fortran/109202] New: gfortran -M outputs dependency cycle

2023-03-19 Thread volker.weissmann at gmx dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109202

Bug ID: 109202
   Summary: gfortran -M outputs dependency cycle
   Product: gcc
   Version: 12.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: volker.weissmann at gmx dot de
  Target Milestone: ---

How to reproduce:

$ cat foo.f90
module circle
integer :: x
end module circle
program prog
use, non_intrinsic :: circle, only: x
end program prog
$ gfortran -cpp -M  -c foo.f90
circle.mod foo.o: foo.f90 /usr/include/finclude/math-vector-fortran.h \
 circle.mod

Why is this a problem?
This leads ninja to complain that there is a dependency cycle: circle.mod
depends on circle.mod

[Bug translation/107467] New: Miscompilation involing -Os , -flto and -fno-strict-aliasing

2022-10-30 Thread volker.weissmann at gmx dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107467

Bug ID: 107467
   Summary: Miscompilation involing -Os , -flto and
-fno-strict-aliasing
   Product: gcc
   Version: 12.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: translation
  Assignee: unassigned at gcc dot gnu.org
  Reporter: volker.weissmann at gmx dot de
  Target Milestone: ---

Created attachment 53798
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53798=edit
Source Code

g++ -g Record.cpp -c -fPIC -Os -flto
g++ -g -shared Record.o -fno-strict-aliasing -o librecord.so
g++ main.cpp -L. -lrecord
LD_LIBRARY_PATH=$PWD ./a.out

This sometimes prints 1 and sometimes prints 0.
If I remove the -fno-strict-aliasing flag of the second g++ command, or add it
to the first g++ command, it always prints 1.

There is no violation of the strict-aliasing rule in Record.cpp, at least none
that I could spot.

If you are afraid of non-reproducibility, fear not, the generated assembly is
the same every time, and is obviously wrong:

The method Combined::clashy() is missing a call to get_const

objdump librecord.so --disassemble=_ZN8CombinedI10OtherClassE6clashyEv.isra.0
113e <_ZN8CombinedI10OtherClassE6clashyEv.isra.0>:
113e:   48 83 ec 38 sub$0x38,%rsp
1142:   64 48 8b 04 25 28 00mov%fs:0x28,%rax
1149:   00 00 
114b:   48 89 44 24 28  mov%rax,0x28(%rsp)
1150:   31 c0   xor%eax,%eax
1152:   48 8d 74 24 18  lea0x18(%rsp),%rsi
1157:   48 8d 7c 24 08  lea0x8(%rsp),%rdi
115c:   e8 b9 ff ff ff  call   111a
<_Z13compare_pairsIP10OtherClassEbRKSt4pairIiT_ES6_>
1161:   48 8b 54 24 28  mov0x28(%rsp),%rdx
1166:   64 48 2b 14 25 28 00sub%fs:0x28,%rdx
116d:   00 00 
116f:   74 05   je 1176
<_ZN8CombinedI10OtherClassE6clashyEv.isra.0+0x38>
1171:   e8 ca fe ff ff  call   1040 <__stack_chk_fail@plt>
1176:   48 83 c4 38 add$0x38,%rsp
117a:   c3  ret


The almost identical Combined::clashy() gets compiled correctly:

objdump librecord.so --disassemble=_ZN8CombinedI9SomeClassE6clashyEv.isra.0
117c <_ZN8CombinedI9SomeClassE6clashyEv.isra.0>:
117c:   48 83 ec 38 sub$0x38,%rsp
1180:   64 48 8b 04 25 28 00mov%fs:0x28,%rax
1187:   00 00 
1189:   48 89 44 24 28  mov%rax,0x28(%rsp)
118e:   31 c0   xor%eax,%eax
1190:   48 8d 74 24 18  lea0x18(%rsp),%rsi
1195:   48 8d 7c 24 08  lea0x8(%rsp),%rdi
119a:   e8 97 ff ff ff  call   1136
<_ZN8CombinedI9SomeClassE9get_constEv.constprop.0>
119f:   48 89 54 24 20  mov%rdx,0x20(%rsp)
11a4:   89 44 24 18 mov%eax,0x18(%rsp)
11a8:   e8 89 ff ff ff  call   1136
<_ZN8CombinedI9SomeClassE9get_constEv.constprop.0>
11ad:   48 89 54 24 10  mov%rdx,0x10(%rsp)
11b2:   89 44 24 08 mov%eax,0x8(%rsp)
11b6:   e8 5f ff ff ff  call   111a
<_Z13compare_pairsIP10OtherClassEbRKSt4pairIiT_ES6_>
11bb:   48 8b 54 24 28  mov0x28(%rsp),%rdx
11c0:   64 48 2b 14 25 28 00sub%fs:0x28,%rdx
11c7:   00 00 
11c9:   74 05   je 11d0
<_ZN8CombinedI9SomeClassE6clashyEv.isra.0+0x54>
11cb:   e8 70 fe ff ff  call   1040 <__stack_chk_fail@plt>
11d0:   48 83 c4 38 add$0x38,%rsp
11d4:   c3  ret


$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++,d --enable-bootstrap
--prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/
--with-build-config=bootstrap-lto --with-linker-hash-style=gnu
--with-system-zlib --enable-__cxa_atexit --enable-cet=auto
--enable-checking=release --enable-clocale=gnu --enable-default-pie
--enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object
--enable-libstdcxx-backtrace --enable-link-serialization=1
--enable-linker-build-id --enable-lto --enable-multilib --enable-plugin
--enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch
--disable-werror
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.2.0 (GCC) 

$ cat main.cpp
void other_func();
int main() { other_func(); }

[Bug tree-optimization/107427] New: ICE Segmentation fault when -O1 -fdisable-tree-lower -fdisable-tree-eh is given

2022-10-26 Thread volker.weissmann at gmx dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107427

Bug ID: 107427
   Summary: ICE Segmentation fault when -O1 -fdisable-tree-lower
-fdisable-tree-eh is given
   Product: gcc
   Version: 12.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: volker.weissmann at gmx dot de
  Target Milestone: ---

$ cat main.c
void func(){}

$ gcc -c main.c -O1 -fdisable-tree-lower -fdisable-tree-eh
cc1: note: disable pass tree-lower for functions in the range of [0,
4294967295]
cc1: note: disable pass tree-eh for functions in the range of [0, 4294967295]
during GIMPLE pass: local-pure-const
main.c: In function ‘func’:
main.c:1:1: internal compiler error: Segmentation fault
1 | void func(){}
  | ^~~~
0x1840d78 internal_error(char const*, ...)
???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://bugs.archlinux.org/> for instructions.

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++,d --enable-bootstrap
--prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/
--with-build-config=bootstrap-lto --with-linker-hash-style=gnu
--with-system-zlib --enable-__cxa_atexit --enable-cet=auto
--enable-checking=release --enable-clocale=gnu --enable-default-pie
--enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object
--enable-libstdcxx-backtrace --enable-link-serialization=1
--enable-linker-build-id --enable-lto --enable-multilib --enable-plugin
--enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch
--disable-werror
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.2.0 (GCC)

[Bug lto/107418] lto-dump -gimple-stats Segmentation Fault

2022-10-26 Thread volker.weissmann at gmx dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107418

--- Comment #1 from Volker Weißmann  ---
If you don't like that I enabled -flto, but disabled the optimizer, tell me,
then I minify another example that triggers the same segfault, even if -Os is
given.

[Bug lto/107418] New: lto-dump -gimple-stats Segmentation Fault

2022-10-26 Thread volker.weissmann at gmx dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107418

Bug ID: 107418
   Summary: lto-dump -gimple-stats Segmentation Fault
   Product: gcc
   Version: 12.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: lto
  Assignee: unassigned at gcc dot gnu.org
  Reporter: volker.weissmann at gmx dot de
CC: marxin at gcc dot gnu.org
  Target Milestone: ---

I don't understand what -gimple-stats does, but I don't think it should
segfault:

$ g++ bug.cpp -c -flto && lto-dump bug.o -gimple-stats
during IPA pass: modref
lto-dump: internal compiler error: Segmentation fault
0x1788bc4 internal_error(char const*, ...)
???:0
0x6e8ba3 cgraph_node::get_untransformed_body()
???:0
0x67ebd7 lto_main()
???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://bugs.archlinux.org/> for instructions.

bug.cpp:
class MyClass  {
  public:
  MyClass(){}
};
void func() {
  new MyClass();
}

I used the gcc from the Archlinux repository:
$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++,d --enable-bootstrap
--prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/
--with-build-config=bootstrap-lto --with-linker-hash-style=gnu
--with-system-zlib --enable-__cxa_atexit --enable-cet=auto
--enable-checking=release --enable-clocale=gnu --enable-default-pie
--enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object
--enable-libstdcxx-backtrace --enable-link-serialization=1
--enable-linker-build-id --enable-lto --enable-multilib --enable-plugin
--enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch
--disable-werror
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.2.0 (GCC) 

If I build gcc myself, I get a backtrace with line numbers:
$ g++ bug.cpp -c -flto && lto-dump bug.o -gimple-stats  
/home/volker/Documents/localgcc/../gcc/gcc/cgraph.cc:4001:23: runtime error:
member access within null pointer of type 'struct lto_in_decl_state'
during IPA pass: modref
lto-dump: internal compiler error: Segmentation fault
0x2e693dd crash_signal
/home/volker/Documents/localgcc/../gcc/gcc/toplev.cc:314
0x10203df cgraph_node::get_untransformed_body()
/home/volker/Documents/localgcc/../gcc/gcc/cgraph.cc:4001
0xbd1cee lto_main()
/home/volker/Documents/localgcc/../gcc/gcc/lto/lto-dump.cc:350
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

Self-build-gcc:
$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/home/volker/Documents/myroot/libexec/gcc/x86_64-pc-linux-gnu/13.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /home/volker/Documents/localgcc/../gcc/configure
--enable-checking --disable-bootstrap --prefix=/home/volker/Documents/myroot
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.0.0 20221023 (experimental) (GCC)

[Bug c++/93716] New: [feature request] Improve error message for Classes without a default constructor

2020-02-12 Thread volker.weissmann at gmx dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93716

Bug ID: 93716
   Summary: [feature request] Improve error message for Classes
without a default constructor
   Product: gcc
   Version: 9.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: volker.weissmann at gmx dot de
  Target Milestone: ---

Consider the following C++ source code:
-
class NoDefaultConstr
{
public:
NoDefaultConstr(int i)
{
(void) i;
}
};
class BadClass
{
public:
NoDefaultConstr obj;
int othervar;
BadClass(int i):
othervar(17)
{
(void) i;
}
};
int main()
{
BadClass abc(123);
}
-
Compilation of the code above should fail. Compiling with g++ main.cpp fails
with the following output:
-
main.cpp: In constructor ‘BadClass::BadClass(int)’:
main.cpp:15:20: error: no matching function for call to
‘NoDefaultConstr::NoDefaultConstr()’
   15 | othervar(17)
  |^
main.cpp:4:5: note: candidate: ‘NoDefaultConstr::NoDefaultConstr(int)’
4 | NoDefaultConstr(int i)
  | ^~~
main.cpp:4:5: note:   candidate expects 1 argument, 0 provided
main.cpp:1:7: note: candidate: ‘constexpr
NoDefaultConstr::NoDefaultConstr(const NoDefaultConstr&)’
1 | class NoDefaultConstr
  |   ^~~
main.cpp:1:7: note:   candidate expects 1 argument, 0 provided
main.cpp:1:7: note: candidate: ‘constexpr
NoDefaultConstr::NoDefaultConstr(NoDefaultConstr&&)’
main.cpp:1:7: note:   candidate expects 1 argument, 0 provided
-
Compiling fails as it should, but it would be nice if the error message would
be a bit more helpful. e.g.:
-
main.cpp: In constructor ‘BadClass::BadClass(int)’:
main.cpp:15:20: error: no matching function for call to
‘NoDefaultConstr::NoDefaultConstr()’
   15 | othervar(17)
  |^
main.cpp:12:23: note: Because of declaration of object ‘obj’
   12 | NoDefaultConstr obj;
  |
main.cpp:4:5: note: candidate: ‘NoDefaultConstr::NoDefaultConstr(int)’
4 | NoDefaultConstr(int i)
  | ^~~
main.cpp:4:5: note:   candidate expects 1 argument, 0 provided
main.cpp:1:7: note: candidate: ‘constexpr
NoDefaultConstr::NoDefaultConstr(const NoDefaultConstr&)’
1 | class NoDefaultConstr
  |   ^~~
main.cpp:1:7: note:   candidate expects 1 argument, 0 provided
main.cpp:1:7: note: candidate: ‘constexpr
NoDefaultConstr::NoDefaultConstr(NoDefaultConstr&&)’
main.cpp:1:7: note:   candidate expects 1 argument, 0 provided
-
The reason why I do not like gcc's error message is that it never mentions the
line 12 or the variable obj. Clang in comparison mentions both and has imho a
much nicer error message:
-
main.cpp:14:5: error: constructor for 'BadClass' must explicitly initialize the
member 'obj' which does not have a default constructor
BadClass(int i):
^
main.cpp:12:21: note: member is declared here
NoDefaultConstr obj;
^
main.cpp:1:7: note: 'NoDefaultConstr' declared here
class NoDefaultConstr
  ^
-