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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2018-05-03
                 CC|                            |kargl at gcc dot gnu.org,
                   |                            |tkoenig at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from kargl at gcc dot gnu.org ---
This seems to be a problem in the gfc_code_walker() chain.
Note, even if I use -fno-frontend-optimize, I still hit the
problem.  If try

gfcx -o z a.f90 -fno-frontend-optimize

and watch for an explosion in memory usage in top I see

last pid:   489;  load averages:  0.13,  0.22,  0.18    up 16+00:00:59 
16:07:16
68 processes:  1 running, 64 sleeping, 3 stopped
CPU:  0.5% user,  0.1% nice,  0.2% system,  0.0% interrupt, 99.1% idle
Mem: 3977M Active, 12G Inact, 695M Laundry, 2153M Wired, 830M Buf, 12G Free
Swap: 16G Total, 84M Used, 16G Free

  PID USERNAME    THR PRI NICE   SIZE    RES STATE   C   TIME    WCPU COMMAND
  484 sgk           1  40    0  3280M  3271M STOP    1   0:04   0.00% f951
  487 sgk           1  40    0   340M   316M select  2   0:03   0.00% gdb81

suspending the compilation with ^Z and attaching gdb81 to PID 484 gives

#0  memset () at /usr/src/lib/libc/amd64/string/memset.S:51
#1  0x000000020307ae09 in tcache_alloc_small (arena=<optimized out>, size=0, 
    tsd=<optimized out>, tcache=<optimized out>, binind=<optimized out>, 
    zero=<optimized out>, slow_path=<optimized out>)
    at /usr/src/contrib/jemalloc/include/jemalloc/internal/tcache_inlines.h:117
#2  arena_malloc (tsdn=<optimized out>, size=<optimized out>, zero=255, 
    tcache=<optimized out>, slow_path=false, arena=<optimized out>, 
    ind=<optimized out>)
    at
/usr/src/contrib/jemalloc/include/jemalloc/internal/arena_inlines_b.h:101
#3  iallocztm (size=<optimized out>, zero=255, tcache=<optimized out>, 
    is_internal=false, slow_path=false, tsdn=<optimized out>, 
    ind=<optimized out>, arena=<optimized out>)
    at
/usr/src/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_c.h:33
#4  imalloc_no_sample (tsd=<optimized out>, size=<optimized out>, usize=3072, 
    sopts=<optimized out>, dopts=<optimized out>, ind=<optimized out>)
    at jemalloc_jemalloc.c:1654
#5  imalloc_body (tsd=<optimized out>, sopts=<optimized out>, 
    dopts=<optimized out>) at jemalloc_jemalloc.c:1850
#6  imalloc (sopts=<optimized out>, dopts=<optimized out>)
    at jemalloc_jemalloc.c:1950
#7  __calloc (num=<optimized out>, num@entry=1, size=<optimized out>, 
    size@entry=2680) at jemalloc_jemalloc.c:2064
#8  0x000000000160ca11 in xcalloc (nelem=nelem@entry=1, 
    elsize=elsize@entry=2680) at ../../gcc/libiberty/xmalloc.c:162
#9  0x000000000080b57d in gfc_get_namespace (parent=parent@entry=0x203caf000, 
    parent_types=parent_types@entry=1) at ../../gcc/gcc/fortran/symbol.c:2824
#10 0x00000000007d1c93 in gfc_build_block_ns(gfc_namespace*) ()
    at ../../gcc/gcc/fortran/parse.c:4429
#11 0x00000000008a884f in insert_block ()
    at ../../gcc/gcc/fortran/frontend-passes.c:673
#12 0x00000000008a8cca in insert_block ()
    at ../../gcc/gcc/fortran/frontend-passes.c:644
#13 create_var(gfc_expr*, char const*) ()
    at ../../gcc/gcc/fortran/frontend-passes.c:728
#14 0x00000000008a9190 in realloc_string_callback (c=0x2ca244808, 
    walk_subtrees=<optimized out>, data=<optimized out>)
    at ../../gcc/gcc/fortran/frontend-passes.c:291
#15 0x00000000008ad2ca in gfc_code_walker (c=0x2ca244808, 
    codefn=codefn@entry=0x8a90d0 <realloc_string_callback(gfc_code**, int*,
void *)>, 
    exprfn=exprfn@entry=0x8a6eb0 <dummy_expr_callback(gfc_expr**, int*,
void*)>, data=data@entry=0x0) at ../../gcc/gcc/fortran/frontend-passes.c:4569
#16 0x00000000008ad88d in gfc_code_walker (c=0x2ca243c08, 
    codefn=codefn@entry=0x8a90d0 <realloc_string_callback(gfc_code**, int*,
void*)>, 
    exprfn=exprfn@entry=0x8a6eb0 <dummy_expr_callback(gfc_expr**, int*,
void*)>, data=data@entry=0x0) at ../../gcc/gcc/fortran/frontend-passes.c:4593
#17 0x00000000008ad88d in gfc_code_walker (c=0x2ca243008, 
    codefn=codefn@entry=0x8a90d0 <realloc_string_callback(gfc_code**, int*,
void*)>, 
    exprfn=exprfn@entry=0x8a6eb0 <dummy_expr_callback(gfc_expr**, int*,
void*)>, data=data@entry=0x0) at ../../gcc/gcc/fortran/frontend-passes.c:4593
#18 0x00000000008ad88d in gfc_code_walker (c=0x2ca242408, 
    codefn=codefn@entry=0x8a90d0 <realloc_string_callback(gfc_code**, int*,
void

There are an additional 12 frames 

#31 0x00000000008ad88d in gfc_code_walker (c=0x2ca231808, 
    codefn=codefn@entry=0x8a90d0 <realloc_string_callback(gfc_code**, int*,
void*)>, 
    exprfn=exprfn@entry=0x8a6eb0 <dummy_expr_callback(gfc_expr**, int*,
void*)>, data=data@entry=0x0) at ../../gcc/gcc/fortran/frontend-passes.c:4593

Reply via email to