Bug 77954 - LTO_STREAMER_DEBUG ICE with OpenMP SIMD clones
Summary: LTO_STREAMER_DEBUG ICE with OpenMP SIMD clones
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: lto (show other bugs)
Version: 7.0
: P3 normal
Target Milestone: ---
Assignee: Martin Liška
URL:
Keywords: lto, openmp
Depends on:
Blocks:
 
Reported: 2016-10-12 13:36 UTC by Thomas Schwinge
Modified: 2017-05-03 09:35 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2017-04-28 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Schwinge 2016-10-12 13:36:39 UTC
If you enable gcc/lto-streamer.h:LTO_STREAMER_DEBUG, the libgomp.fortran/declare-simd-4.f90 test case will run into an ICE, because of gcc/lto-streamer.c:lto_orig_address_remove failing in "gcc_assert (slot)".

If Intel MIC (emulated) offloading is enabled, libgomp.c/examples-4/declare_target-5.c and libgomp.fortran/examples-4/declare_target-5.f90 fail in the same way.

I have not analyzed whether that is a real problem, or "just" a problem with LTO_STREAMER_DEBUG -- but bootstrap build and full testsuite run with LTO_STREAMER_DEBUG enabled doesn't exhibit any additional problems.
Comment 1 Martin Liška 2017-04-28 13:53:26 UTC
Can I reproduce it on a normal GCC (no target compiler) on my x86_64-linux-gnu target?

After setting the macro, following works for me:
./gcc/xgcc -B gcc /home/marxin/Programming/gcc/libgomp/testsuite/libgomp.fortran/declare-simd-4.f90 -flto -c -mavx -fno-use-linker-plugin -fno-inline
Comment 2 Thomas Schwinge 2017-04-30 10:14:10 UTC
(In reply to Martin Liška from comment #1)
> Can I reproduce it on a normal GCC (no target compiler) on my
> x86_64-linux-gnu target?
> 
> After setting the macro, following works for me:
> ./gcc/xgcc -B gcc /home/marxin/Programming/gcc/libgomp/testsuite/libgomp.fortran/declare-simd-4.f90 -flto -c -mavx -fno-use-linker-plugin -fno-inline

Drop "-c", and "-fno-use-linker-plugin", and add "-fopenmp" (and "-Bx86_64-pc-linux-gnu/libgomp/{,.libs/}", or similar):

    $ build-gcc/gcc/xgcc -Bbuild-gcc/gcc/ -Bbuild-gcc/x86_64-pc-linux-gnu/libgomp/{,.libs/} source-gcc/libgomp/testsuite/libgomp.fortran/declare-simd-4.f90 -flto -fopenmp 
    lto1: internal compiler error: in lto_orig_address_remove, at lto-streamer.c:369
    0x901fbd lto_orig_address_remove(tree_node*)
            [...]/source-gcc/gcc/lto-streamer.c:369
    0x902f77 lto_read_tree
            [...]/source-gcc/gcc/lto-streamer-in.c:1363
    0x902f77 lto_input_tree_1(lto_input_block*, data_in*, LTO_tags, unsigned int)
            [...]/source-gcc/gcc/lto-streamer-in.c:1475
    0x903192 lto_input_scc(lto_input_block*, data_in*, unsigned int*, unsigned int*)
            [...]/source-gcc/gcc/lto-streamer-in.c:1387
    0x5c02a6 lto_read_decls
            [...]/source-gcc/gcc/lto/lto.c:1694
    0x5c2f5d lto_file_finalize
            [...]/source-gcc/gcc/lto/lto.c:2038
    0x5c2f5d lto_create_files_from_ids
            [...]/source-gcc/gcc/lto/lto.c:2048
    0x5c2f5d lto_file_read
            [...]/source-gcc/gcc/lto/lto.c:2089
    0x5c2f5d read_cgraph_and_symbols
            [...]/source-gcc/gcc/lto/lto.c:2801
    0x5c2f5d lto_main()
            [...]/source-gcc/gcc/lto/lto.c:3306
    Please submit a full bug report,
    with preprocessed source if appropriate.
    Please include the complete backtrace with any bug report.
    See <https://gcc.gnu.org/bugs/> for instructions.
    lto-wrapper: fatal error: build-gcc/gcc/xgcc returned 1 exit status
    compilation terminated.
    /usr/bin/ld: lto-wrapper failed
    collect2: error: ld returned 1 exit status
Comment 3 Martin Liška 2017-05-02 10:46:21 UTC
Confirmed, I've got patch for that.
Comment 4 Martin Liška 2017-05-02 15:10:29 UTC
Author: marxin
Date: Tue May  2 15:00:47 2017
New Revision: 247501

URL: https://gcc.gnu.org/viewcvs?rev=247501&root=gcc&view=rev
Log:
Remove LTO_STREAMER_DEBUG (PR lto/79489).

2017-05-02  Martin Liska  <mliska@suse.cz>

	PR lto/79489.
	* lto-streamer-in.c (lto_read_tree_1): Remove
	LTO_STREAMER_DEBUG.
	* lto-streamer.c (struct tree_hash_entry): Likewise.
	(struct tree_entry_hasher): Likewise.
	(tree_entry_hasher::hash): Likewise.
	(tree_entry_hasher::equal): Likewise.
	(lto_streamer_init): Likewise.
	(lto_orig_address_map): Likewise.
	(lto_orig_address_get): Likewise.
	(lto_orig_address_remove): Likewise.
	* lto-streamer.h: Likewise.
	* tree-streamer-in.c (streamer_alloc_tree): Likewise.
	* tree-streamer-out.c (streamer_write_tree_header): Likewise.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/lto-streamer-in.c
    trunk/gcc/lto-streamer.c
    trunk/gcc/lto-streamer.h
    trunk/gcc/tree-streamer-in.c
    trunk/gcc/tree-streamer-out.c
Comment 5 Martin Liška 2017-05-02 15:12:08 UTC
Fixed on trunk.
Comment 6 Thomas Schwinge 2017-05-02 16:14:26 UTC
(In reply to Martin Liška from comment #4)
> Remove LTO_STREAMER_DEBUG ([...]).

Thanks!  I'm fine with that -- but you do have verified that it's really just LTO_STREAMER_DEBUG that was broken, and not some lingering OMP/SIMD problem?
Comment 7 Martin Liška 2017-05-03 07:32:23 UTC
(In reply to Thomas Schwinge from comment #6)
> (In reply to Martin Liška from comment #4)
> > Remove LTO_STREAMER_DEBUG ([...]).
> 
> Thanks!  I'm fine with that -- but you do have verified that it's really
> just LTO_STREAMER_DEBUG that was broken, and not some lingering OMP/SIMD
> problem?

Yes, would be fixed by https://github.com/marxin/gcc/commit/978c7e3436f91f3a1e94dfb63ba79e72b4f35715
Comment 8 Thomas Schwinge 2017-05-03 09:00:49 UTC
Thanks for confirming, and sorry for the extra work that you did.  :-/
Comment 9 Martin Liška 2017-05-03 09:35:12 UTC
(In reply to Thomas Schwinge from comment #8)
> Thanks for confirming, and sorry for the extra work that you did.  :-/

No problem ;)