gcc -E segfaults if you call print() from input_end()

RESOLVED FIXED

Status

()

Core
Rewriting and Analysis
RESOLVED FIXED
8 years ago
8 years ago

People

(Reporter: Edwin Smith, Assigned: Ehren Metcalfe)

Tracking

Trunk
x86
Mac OS X
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

1.31 KB, patch
Ehren Metcalfe
: review+
Details | Diff | Splinter Review
(Reporter)

Description

8 years ago
gcc -E does not invoke process_type() or other dehydra entry points, but does invoke input_end(), and if you call print() at that point, gcc segfaults.

this is with gcc-4.3, built from this script:
http://hg.mozilla.org/users/edwsmith_adobe.com/build-dehydra/file/80ef8c359fe4/build-dehydra

dehydra and spidermonkey were built from latest mercurial sources.

command-line:

$HOME/build-dehydra/installed/bin/gcc \
  -fplugin=$HOME/build-dehydra/dehydra/gcc_dehydra.so \
  -fplugin-arg=$HOME/crasher.js \
  -E t.c

crasher.js:

function process_type(type,body) { print("process_type") } // not called
function input_end() { print("input_end") } // causes crash

t.c:

#include <stdio.h>
int main(int argc, char**argv) { printf("hello world\n"); }
(Assignee)

Comment 1

8 years ago
Created attachment 470050 [details] [diff] [review]
patch

pretty simple fix with the attendant suckiness of dealing with 4.3 as well (could be refactored but I like having the check in plugin_init assuming we eventually rip out the 4.3 bits).
Assignee: nobody → ehren.m
Attachment #470050 - Flags: review?(tglek)

Updated

8 years ago
Attachment #470050 - Flags: review?(tglek) → review+
(Assignee)

Comment 2

8 years ago
Created attachment 470060 [details] [diff] [review]
patch

slightly different version with the added bonus of not crashing immediately during treehydra bootstrap on 4.3.

(carrying over r+)
Attachment #470050 - Attachment is obsolete: true
Attachment #470060 - Flags: review+
(Assignee)

Comment 3

8 years ago
http://hg.mozilla.org/rewriting-and-analysis/dehydra/rev/403ddb34e245
Status: NEW → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.