[PATCH] PR 78534 Change character length from int to size_t

Janne Blomqvist blomqvist.janne@gmail.com
Fri Dec 16 18:07:00 GMT 2016


On Fri, Dec 16, 2016 at 5:50 PM, Dominique d'Humières
<dominiq@lps.ens.fr> wrote:
> Hi Janne,
>
> I have applied your two patches and found that I had to skip the patches for resolve.c and match.c due to the errors
>
> ../../p_work/gcc/fortran/resolve.c: In function 'void resolve_select_type(gfc_code*, gfc_namespace*)':
> ../../p_work/gcc/fortran/resolve.c:8731:58: error: format '%lld' expects argument of type 'long long int', but argument 4 has type 'long int' [-Werror=format=]
>       gfc_basic_typename (c->ts.type), charlen, c->ts.kind);
>
> and
>
> ../../p_work/gcc/fortran/match.c: In function 'gfc_symtree* select_intrinsic_set_tmp(gfc_typespec*)':
> ../../p_work/gcc/fortran/match.c:5786:55: error: format '%lld' expects argument of type 'long long int', but argument 4 has type 'long int' [-Werror=format=]
>        gfc_basic_typename (ts->type), charlen, ts->kind);
>

Oh, blast. Of course you're right, from the second patch, the part
that touched resolve.c and match.c are incorrect.

> while the patch for dump-parse-tree.c was needed.
>
> With the patches applied I see several failures in the test suite compiled with ‘-m64 -flto’, but not with ‘-m32 -flto’ of the kind

Ok, thanks for the hint. I haven't tested with -flto.  Do you just run
it with something like

CFLAGS="-flto" make -j $NCPUS check-fortran

or how do you do it?

I don't have lldb, but I guess I can see roughly the same with gdb..

>
> [Book15] f90/bug% gfc /opt/gcc/work/gcc/testsuite/gfortran.dg/char_result_1.f90 -flto -c
> [Book15] f90/bug% lldb /opt/gcc/gcc7w/libexec/gcc/x86_64-apple-darwin16.1.0/7.0.0/lto1
> (lldb) target create "/opt/gcc/gcc7w/libexec/gcc/x86_64-apple-darwin16.1.0/7.0.0/lto1"
> Current executable set to '/opt/gcc/gcc7w/libexec/gcc/x86_64-apple-darwin16.1.0/7.0.0/lto1' (x86_64).
> (lldb) run char_result_1.o
> Process 1310 launched: '/opt/gcc/gcc7w/libexec/gcc/x86_64-apple-darwin16.1.0/7.0.0/lto1' (x86_64)
> Reading object files: char_result_1.o {GC start 2195k}
> Reading the callgraph
> Merging declarations
> Reading summaries
> Reading function bodies:
> Performing interprocedural optimizations
>  <whole-program> <profile_estimate> <icf> <devirt> <cp> <targetclone> <inline> <pure-const> <static-var>Assembling functions:
>  <materialize-all-clones> <dispatchercalls> <simdclone> f2 f1 double test MAIN__Process 1310 stopped
> * thread #1: tid = 0x54ac, 0x00000001008f76cf lto1`lto_input_tree_ref(ib=<unavailable>, data_in=0x0000000142621090, fn=0x0000000000000000, tag=<unavailable>) + 127 at lto-streamer-in.c:332, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x18)
>     frame #0: 0x00000001008f76cf lto1`lto_input_tree_ref(ib=<unavailable>, data_in=0x0000000142621090, fn=0x0000000000000000, tag=<unavailable>) + 127 at lto-streamer-in.c:332
>    329
>    330      case LTO_ssa_name_ref:
>    331        ix_u = streamer_read_uhwi (ib);
> -> 332        result = (*SSANAMES (fn))[ix_u];
>    333        break;
>    334
>    335      case LTO_field_decl_ref:
> (lldb) bt
> * thread #1: tid = 0x54ac, 0x00000001008f76cf lto1`lto_input_tree_ref(ib=<unavailable>, data_in=0x0000000142621090, fn=0x0000000000000000, tag=<unavailable>) + 127 at lto-streamer-in.c:332, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x18)
>   * frame #0: 0x00000001008f76cf lto1`lto_input_tree_ref(ib=<unavailable>, data_in=0x0000000142621090, fn=0x0000000000000000, tag=<unavailable>) + 127 at lto-streamer-in.c:332
>     frame #1: 0x00000001008f78f1 lto1`lto_input_tree_1(ib=0x00007fff5fbfeeb0, data_in=0x0000000142621090, tag=<unavailable>, hash=<unavailable>) + 177 at lto-streamer-in.c:1446
>     frame #2: 0x00000001008f7cb8 lto1`lto_input_tree(ib=0x00007fff5fbfeeb0, data_in=0x0000000142621090) + 88 at lto-streamer-in.c:1492
>     frame #3: 0x0000000100ce8b43 lto1`streamer_read_tree_body(lto_input_block*, data_in*, tree_node*) + 51 at tree-streamer-in.c:893
>     frame #4: 0x0000000100ce8b10 lto1`streamer_read_tree_body(ib=0x00007fff5fbfeeb0, data_in=0x0000000142621090, expr=0x0000000143944af0) + 2096
>     frame #5: 0x00000001008f7110 lto1`::lto_read_tree_1(ib=0x00007fff5fbfeeb0, data_in=0x0000000142621090, expr=0x0000000143944af0) + 32 at lto-streamer-in.c:1333
>     frame #6: 0x00000001008f78b9 lto1`lto_input_tree_1(lto_input_block*, data_in*, LTO_tags, unsigned int) + 38 at lto-streamer-in.c:1363
>     frame #7: 0x00000001008f7893 lto1`lto_input_tree_1(lto_input_block*, data_in*, LTO_tags, unsigned int) + 20
>     frame #8: 0x00000001008f787f lto1`lto_input_tree_1(ib=0x00007fff5fbfeeb0, data_in=0x0000000142621090, tag=<unavailable>, hash=2871463685) + 63
>     frame #9: 0x00000001008f7c03 lto1`lto_input_scc(ib=0x00007fff5fbfeeb0, data_in=0x0000000142621090, len=0x00007fff5fbfede8, entry_len=0x00007fff5fbfedec) + 371 at lto-streamer-in.c:1387
>     frame #10: 0x00000001008f7c91 lto1`lto_input_tree(ib=0x00007fff5fbfeeb0, data_in=0x0000000142621090) + 49 at lto-streamer-in.c:1490
>     frame #11: 0x00000001008f8d93 lto1`::lto_read_body_or_constructor(file_data=0x0000000143721000, data=<unavailable>, node=<unavailable>, section_type=LTO_section_function_body) + 931 at lto-streamer-in.c:1045
>     frame #12: 0x000000010051a136 lto1`cgraph_node::get_untransformed_body(this=0x000000014391ee60) + 278 at cgraph.c:3581
>     frame #13: 0x0000000100526d9a lto1`cgraph_node::expand(this=0x000000014391ee60) + 74 at cgraphunit.c:1971
>     frame #14: 0x0000000100527f00 lto1`::output_in_order(no_reorder=<unavailable>) + 528 at cgraphunit.c:2244
>     frame #15: 0x0000000100528528 lto1`symbol_table::compile(this=0x0000000143526100) + 952 at cgraphunit.c:2488
>     frame #16: 0x0000000100034c68 lto1`lto_main() + 7112 at lto.c:3330
>     frame #17: 0x0000000100a87f1a lto1`::compile_file() + 58 at toplev.c:463
>     frame #18: 0x0000000100f97744 lto1`toplev::main(this=0x00007fff5fbff2b0, argc=<unavailable>, argv=<unavailable>) + 3636 at toplev.c:1983
>     frame #19: 0x0000000100f98c39 lto1`main(argc=2, argv=0x00007fff5fbff2f8) + 41 at main.c:39
>     frame #20: 0x00007fffcfa5a255 libdyld.dylib`start + 1
>     frame #21: 0x00007fffcfa5a255 libdyld.dylib`start + 1
>
> The affected tests are
>
> array_constructor_17.f90
> auto_char_len_3.f90
> char_length_14.f90
> char_length_5.f90
> char_result_*.f90
> charlen_03.f90
> deferred_type_param_4.f90
> dummy_procedure_3.f90
> mapping_[12].f90
> module_read_[12].f90
> parens_5.f90
> pr57910.f90
> proc_ptr_comp_16.f90
> result_in_spec_2.f90
> spec_expr_7.f90
> string_length_1.f90
> transfer_intrinsic_3.f90
> widechar_6.f90
> zero_length_1.f90
>
> Note that I did not run lldb on all of them, thus I cannot guarantee that all fail along the same pattern.
>
> Cheers,
>
> Dominique
>



-- 
Janne Blomqvist



More information about the Gcc-patches mailing list