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

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Jan Hubicka from comment #1)
> This seems to work for me with current trunk

No, it's broken also on current trunk.

> 
> hubicka@lomikamen-jh:/aux/hubicka/trunk4/build2/gcc$ cat ~/1.ii
> extern "C" {
> struct {
> } ltregul_;
> }
> hubicka@lomikamen-jh:/aux/hubicka/trunk4/build2/gcc$ cat ~/2.F
> common /ltregul/ zeroeps
>         end         
> hubicka@lomikamen-jh:/aux/hubicka/trunk4/build2/gcc$ ./gfortran -B ./ ~/1.ii
> ~/2.F -flto -O2     -B ../x86_64-pc-linux-gnu/libgfortran/
> hubicka@lomikamen-jh:/aux/hubicka/trunk4/build2/gcc$ ./xg++ -B ./ ~/1.ii
> ~/2.F -flto -O2     -B ../x86_64-pc-linux-gnu/libgfortran/
> /usr/local/x86_64-pc-linux-gnu/bin/ld: /tmp/cck5WNC7.ltrans0.ltrans.o: in
> function `main':
> <artificial>:(.text.startup+0x5): undefined reference to `_gfortran_set_args'
> /usr/local/x86_64-pc-linux-gnu/bin/ld: <artificial>:(.text.startup+0x14):
> undefined reference to `_gfortran_set_options'
> collect2: error: ld returned 1 exit status

Please run it from a location where you have properly installed compiler:

$ gcc -v
gcc --version
gcc (GCC) 10.0.0 20190723 (experimental

$ g++ 1.ii 2.F -flto -O2 
2.F:1:3: warning: type of ‘ltregul’ does not match original declaration
[-Wlto-type-mismatch]
    1 |  common /ltregul/ zeroeps
      |   ^
lto1: internal compiler error: in warn_types_mismatch, at ipa-devirt.c:995
0xcab6f2 warn_types_mismatch(tree_node*, tree_node*, unsigned int, unsigned
int)
        /home/marxin/Programming/gcc/gcc/ipa-devirt.c:995
0x89f8d7 lto_symtab_merge_decls_2
        /home/marxin/Programming/gcc/gcc/lto/lto-symtab.c:722
0x89ffe9 lto_symtab_merge_decls_1
        /home/marxin/Programming/gcc/gcc/lto/lto-symtab.c:861
0x8a00e3 lto_symtab_merge_decls()
        /home/marxin/Programming/gcc/gcc/lto/lto-symtab.c:887
0x8b4854 read_cgraph_and_symbols(unsigned int, char const**)
        /home/marxin/Programming/gcc/gcc/lto/lto-common.c:2839
0x885bb5 lto_main()
        /home/marxin/Programming/gcc/gcc/lto/lto.c:616

Reply via email to