Skip to content

"function may return address of local variable" error with gcc 10.1.1 #16

@jrfondren

Description

@jrfondren
../../../../jsrc/viavx.c: In function 'jtindexofsub':
cc1: warning: function may return address of local variable [-Wreturn-local-addr]
In file included from ../../../../jsrc/j.h:1000,
                 from ../../../../jsrc/viavx.c:8:
../../../../jsrc/viavx.c:1652:71: note: declared here
 1652 | tindexofsub(J jt,I mode,A a,A w){PROLOG(0079);A h=0,z;fauxblockINT(zfaux,1,0);
      |                                                                    ^~~~~

../../../../jsrc/ja.h:363:31: note: in definition of macro 'fauxblockINT'
  363 | #define fauxblockINT(z,n,r) I z[(AKXR(r)>>LGSZI)+(n)]   // define a block, big
enough to hold n atoms at rank r, for use in fauxINT
      |                               ^

shown as a warning here as I passed -Wno-error=return-local-addr after -Werror in the build scripts, to get it to compile.
This error is seen with gcc version 10.1.1 20200507 (Red Hat 10.1.1-1) (GCC) , on Fedora 32 (earlier Fedora versions with earlier gcc versions don't complain about this code).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions