Project

General

Profile

Actions

Bug #13813

closed

libast: function may return address of local variable

Added by Toomas Soome about 1 year ago. Updated 12 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
cmd - userland programs
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

Build error with gcc 10:

    /code/illumos-gate/usr/src/contrib/ast/src/lib/libast/path/pathkey.c: In function '_ast_pathkey_20100601':
    /code/illumos-gate/usr/src/contrib/ast/src/lib/libast/path/pathkey.c:319:34: error: function may return address of local variable [-Werror=return-local-addr]
      319 |  return key == buf ? strdup(key) : key;
          |         ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
    /code/illumos-gate/usr/src/contrib/ast/src/lib/libast/path/pathkey.c:64:9: note: declared here
       64 |  char   buf[15];
          |         ^~~
    cc1: all warnings being treated as errors

Disable this warning. It seems we should be safe, but it could be, I am still missing something....

Actions #1

Updated by Electric Monk about 1 year ago

  • Gerrit CR set to 1498
Actions #2

Updated by Electric Monk 12 months ago

  • Status changed from In Progress to Closed
  • % Done changed from 90 to 100

git commit 69617e9d765c3ae7217200a7f7f5bb470ab27f81

commit  69617e9d765c3ae7217200a7f7f5bb470ab27f81
Author: Toomas Soome <tsoome@me.com>
Date:   2021-05-21T20:05:24.000Z

    13813 libast: function may return address of local variable
    Reviewed by: Andy Fiddaman <andy@omnios.org>
    Reviewed by: Robert Mustacchi <rm@fingolfin.org>
    Approved by: Dan McDonald <danmcd@joyent.com>

Actions

Also available in: Atom PDF