Skip to content

compiler warning when building from source #35

@mm1ke

Description

@mm1ke

Hi,

I'm trying to update loksh on gentoo to the latest version. However i'm seeing compiler warnings when building it:

[35/35] x86_64-pc-linux-gnu-gcc  -o ksh ksh.p/alloc.c.o ksh.p/c_ksh.c.o ksh.p/c_sh.c.o ksh.p/c_test.c.o ksh.p/c_ulimit.c.o ksh.p/edit.c.o ksh.p/emacs.c.o ksh.p/eval.c.o ksh.p/exec.c.o ksh.p/expr.c.o ksh.p/history.c.o ksh.p/io.c.o ksh.p/jobs.c.o ksh.p/lex.c.o ksh.p/mail.c.o ksh.p/main.c.o ksh.p/misc.c.o ksh.p/path.c.o ksh.p/shf.c.o ksh.p/syn.c.o ksh.p/table.c.o ksh.p/trap.c.o ksh.p/tree.c.o ksh.p/tty.c.o ksh.p/var.c.o ksh.p/version.c.o ksh.p/vi.c.o -flto -Wl,--as-needed -Wl,--no-undefined -O2 -pipe -march=znver4 -mshstk --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=1024 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs -fuse-ld=mold -Wl,--start-group subprojects/lolibc/liblolibc.a /usr/lib64/libncurses.so /usr/lib64/libtinfo.so -Wl,--end-group
In function ‘afree’,
    inlined from ‘shf_sclose’ at ../loksh-7.5/shf.c:271:3,
    inlined from ‘shf_snprintf’ at ../loksh-7.5/shf.c:697:2:
../loksh-7.5/alloc.c:127:9: warning: ‘free’ called on unallocated object ‘shf’ [-Wfree-nonheap-object]
  127 |         free(l);
      |         ^
../loksh-7.5/shf.c: In function ‘shf_snprintf’:
../loksh-7.5/shf.c:685:20: note: declared here
  685 |         struct shf shf;
      |                    ^
In function ‘afree’,
    inlined from ‘shf_sclose’ at ../loksh-7.5/shf.c:271:3,
    inlined from ‘shf_smprintf.constprop’ at ../loksh-7.5/shf.c:711:9:
../loksh-7.5/alloc.c:127:9: warning: ‘free’ called on unallocated object ‘shf’ [-Wfree-nonheap-object]
  127 |         free(l);
      |         ^
../loksh-7.5/shf.c: In function ‘shf_smprintf.constprop’:
../loksh-7.5/shf.c:704:20: note: declared here
  704 |         struct shf shf;
      |                    ^
In function ‘afree’,
    inlined from ‘shf_sclose’ at ../loksh-7.5/shf.c:271:3,
    inlined from ‘snptreef’ at ../loksh-7.5/tree.c:358:10:
../loksh-7.5/alloc.c:127:9: warning: ‘free’ called on unallocated object ‘shf’ [-Wfree-nonheap-object]
  127 |         free(l);
      |         ^
../loksh-7.5/tree.c: In function ‘snptreef’:
../loksh-7.5/tree.c:350:14: note: declared here
  350 |   struct shf shf;
      |              ^
In function ‘afree’,
    inlined from ‘shf_sclose’ at ../loksh-7.5/shf.c:271:3,
    inlined from ‘wdstrip’ at ../loksh-7.5/tree.c:561:11,
    inlined from ‘function_body’ at ../loksh-7.5/syn.c:538:10:
../loksh-7.5/alloc.c:127:9: warning: ‘free’ called on unallocated object ‘shf’ [-Wfree-nonheap-object]
  127 |         free(l);
      |         ^
../loksh-7.5/tree.c: In function ‘function_body’:
../loksh-7.5/tree.c:548:20: note: declared here
  548 |         struct shf shf;
      |                    ^

I'm using gcc-14 as compiler.
Is this something which could be fixed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions