Project

General

Profile

Actions

Bug #9896

closed

libdemangle: error: variable 'result' might be clobbered by 'longjmp' or 'vfork'

Added by Toomas Soome almost 3 years ago. Updated almost 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
lib - userland libraries
Start date:
2018-10-14
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

New gcc7 issue was added recently:

    ../common/cxx.c: In function 'cpp_demangle':
    ../common/cxx.c:170:8: error: variable 'result' might be clobbered by 'longjmp' or 'vfork' [-Werror=clobbered]
      char *result = NULL;
            ^~~~~~
    cc1: all warnings being treated as errors
    *** Error code 1
    dmake: Fatal error: Command failed for target `pics/cxx.o'
    Current working directory /code/illumos-gate/usr/src/lib/libdemangle/i386
    *** Error code 1

The [[https://www.illumos.org/rb/r/1235/]] is proposed fix, also note the test done by Andy to check attribute((malloc)) - it did not fix the issue. Also attribute volatile did not help because passing pointer result to memcpy() did cause the effect to be lost. Which left the only option to use local variable and assignment operator.

Actions #1

Updated by Electric Monk almost 3 years ago

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

git commit e239895e13556da6878ec1eda7d795ea494fa359

commit  e239895e13556da6878ec1eda7d795ea494fa359
Author: Toomas Soome <tsoome@me.com>
Date:   2018-10-15T14:42:24.000Z

    9896 libdemangle: error: variable 'result' might be clobbered by 'longjmp' or 'vfork'
    Reviewed by: Andy Fiddaman <andy@omniosce.org>
    Reviewed by: C Fraire <cfraire@me.com>
    Reviewed by: Jason King <jason.brian.king@gmail.com>
    Approved by: Dan McDonald <danmcd@joyent.com>

Actions #2

Updated by Toomas Soome almost 3 years ago

  • Description updated (diff)
Actions

Also available in: Atom PDF