Issue Details (XML | Word | Printable)

Key: PCC-381
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Anders Magnusson
Reporter: Michael W. Bombardieri
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
pcc

Code generated by pcc causes SIGSEGV on access of struct members of function retval

Created: 22/Sep/11 07:04 AM   Updated: 31/Mar/12 10:56 AM
Component/s: i386 target
Affects Version/s: None
Fix Version/s: None

Environment: OpenBSD 4.9 i386


 Description  « Hide
Hi pcc,

I am compiling the OpenBSD make(1) tool using pcc.
Code generated by pcc-i386 causes a segmentation fault.
The same code works fine for pcc-amd64.
The version of PCC I am using is

  pcc 1.1.0.DEVEL 20110919 for i386-unknown-openbsd4.9

Debugging "make clean" always dies at the same line of code.

(gdb) file make.pcc
Reading symbols from /home/mwb/0/src/usr.bin/make/make.pcc...done.
(gdb) run clean
Starting program: /home/mwb/0/src/usr.bin/make/make.pcc clean
rm -f a.out [Ee]rrs mklog core *.core y.tab.h make arch.o buf.o cmd_exec.o compat.o cond.o dir.o direxpand.o engine.o error.o for.o init.o job.o lowparse.o main.o make.o memory.o parse.o parsevar.o str.o stats.o suff.o targ.o targequiv.o timestamp.o var.o varmodifiers.o varname.o lstAddNew.o lstAppend.o lstConcat.o lstConcatDestroy.o lstDeQueue.o lstDestroy.o lstDupl.o lstFindFrom.o lstForEachFrom.o lstInsert.o lstMember.o lstRemove.o lstReplace.o lstRequeue.o lstSucc.o arch.ln buf.ln cmd_exec.ln compat.ln cond.ln dir.ln direxpand.ln engine.ln error.ln for.ln init.ln job.ln lowparse.ln main.ln make.ln memory.ln parse.ln parsevar.ln str.ln stats.ln suff.ln targ.ln targequiv.ln timestamp.ln var.ln varmodifiers.ln varname.ln lstAddNew.ln lstAppend.ln lstConcat.ln lstConcatDestroy.ln lstDeQueue.ln lstDestroy.ln lstDupl.ln lstFindFrom.ln lstForEachFrom.ln lstInsert.ln lstMember.ln lstRemove.ln lstReplace.ln lstRequeue.ln lstSucc.ln generate generate.o regress.o check libohash.a varhashconsts.h condhashconsts.h nodehashconsts.h

Program received signal SIGSEGV, Segmentation fault.
0x1c0036d0 in CompatMake () at compat.c:211
211 if (noExecute || is_out_of_date(Dir_MTime(gn)))
(gdb) bt
#0 0x1c0036d0 in CompatMake () at compat.c:211
#1 0x1c0039d7 in Compat_Run () at compat.c:297
#2 0x1c00ad89 in main () at main.c:814

A second debugging session produces a failure on a near-identical chunk of code..

Program received signal SIGSEGV, Segmentation fault.
0x1c0063f7 in Job_CheckCommands () at engine.c:109
109 } else if (is_out_of_date(Dir_MTime(gn))) {

Expanding the is_out_of_date() macro for the above code we get

  ((Dir_MTime(gn)).tv_sec == (-0x7fffffff-1) && (Dir_MTime(gn)).tv_nsec == 0);

Dir_MTime() returns a value of type struct timespec; I've verified that this function returns as expected.
The macro is_out_of_date() accesses a struct member of the return value of Dir_MTime()
without first assigning it into a variable.
This appears to be what causes the segmentation fault.

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Anders Magnusson made changes - 24/Mar/12 05:57 PM
Field Original Value New Value
Assignee Anders Magnusson [ ragge ]
Anders Magnusson made changes - 31/Mar/12 10:56 AM
Status Open [ 1 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]