Hi Pascal,

Thanks for your email.
Your diff works for clang, but my pcc produces a make binary that doesn't work.
The make binary produced by my diff also fails due to SIGSEGV,
so this might be a bug in pcc itself.
Both diffs appear to work for clang and gcc.

- Michael


$ uname -a
OpenBSD my.precious 4.9 GENERIC#671 i386
$ pcc -v
pcc 1.1.0.DEVEL 20110919 for i386-unknown-openbsd4.9
$ make 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 m
emory.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 lstDeQu
eue.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 co
nd.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 t
imestamp.ln var.ln varmodifiers.ln varname.ln lstAddNew.ln lstAppend.ln 
lstConcat.ln lstConcatDestroy.ln lstDeQueue.ln lstDestroy.ln lstDupl.ln 
lstFindFrom.ln lstForEachFro
m.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 node
hashconsts.h
$ make CC=pcc
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c arch.c
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c buf.c
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c 
cmd_exec.c
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c 
compat.c
cc  -o generate -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make 
-DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD generate.c 
stats.c memory.c
/home/mwb/0/src/usr.bin/make/generate 2 65 >condhashconsts.h
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c cond.c
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c dir.c
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c 
direxpand.c
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c 
engine.c
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c error.c
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c for.c
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c init.c
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c job.c
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c 
lowparse.c
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c main.c
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c make.c
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c 
memory.c
/home/mwb/0/src/usr.bin/make/generate 3 0 >nodehashconsts.h
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c parse.c
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c 
parsevar.c
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c str.c
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c stats.c
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c suff.c
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c targ.c
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c 
targequiv.c
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c 
timestamp.c
/home/mwb/0/src/usr.bin/make/generate 1 77 >varhashconsts.h
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c var.c
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c 
varmodifiers.c
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c 
varname.c
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c 
/home/mwb/0/src/usr
.bin/make/lst.lib/lstAddNew.c
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c 
/home/mwb/0/src/usr
.bin/make/lst.lib/lstAppend.c
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c 
/home/mwb/0/src/usr
.bin/make/lst.lib/lstConcat.c
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c 
/home/mwb/0/src/usr
.bin/make/lst.lib/lstConcatDestroy.c
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c 
/home/mwb/0/src/usr
.bin/make/lst.lib/lstDeQueue.c
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c 
/home/mwb/0/src/usr
.bin/make/lst.lib/lstDestroy.c
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c 
/home/mwb/0/src/usr
.bin/make/lst.lib/lstDupl.c
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c 
/home/mwb/0/src/usr
.bin/make/lst.lib/lstFindFrom.c
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c 
/home/mwb/0/src/usr
.bin/make/lst.lib/lstForEachFrom.c
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c 
/home/mwb/0/src/usr
.bin/make/lst.lib/lstInsert.c
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c 
/home/mwb/0/src/usr
.bin/make/lst.lib/lstMember.c
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c 
/home/mwb/0/src/usr
.bin/make/lst.lib/lstRemove.c
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c 
/home/mwb/0/src/usr
.bin/make/lst.lib/lstReplace.c
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c 
/home/mwb/0/src/usr
.bin/make/lst.lib/lstRequeue.c
pcc -O2 -pipe  -I/home/mwb/0/src/usr.bin/make -I/home/mwb/0/src/usr.bin/make -g 
gdb -DUSE_TIMESPEC -DHAS_BOOL_H -DHAS_PATHS_H -DHAS_EXTENDED_GETCWD   -c 
/home/mwb/0/src/usr
.bin/make/lst.lib/lstSucc.c
pcc   -o 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 lstFindFr
om.o lstForEachFrom.o lstInsert.o lstMember.o lstRemove.o lstReplace.o 
lstRequeue.o lstSucc.o
$ mv make make.pcc
$ gdb
GNU gdb 6.3
(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 m
emory.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 lstDeQu
eue.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 co
nd.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 t
imestamp.ln var.ln varmodifiers.ln varname.ln lstAddNew.ln lstAppend.ln 
lstConcat.ln lstConcatDestroy.ln lstDeQueue.ln lstDestroy.ln lstDupl.ln 
lstFindFrom.ln lstForEachFro
m.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 node
hashconsts.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



On Wed, Sep 21, 2011 at 11:38:31AM +0200, Pascal Stumpf wrote:
> On Wed, Sep 21, 2011 at 10:43:20AM +0800, Michael W. Bombardieri wrote:
> > Hi all,
> > 
> > I noticed that the make(1) build is broken for non-gcc compilers.
> > The following diff stops the build from breaking for pcc and llvm/clang.
> > Comments?
> 
> It effectively negates the inline optimisation when Targ_FindNodeh is
> used in parse.c. I suggested the following diff to espie@ a while ago
> (tested with gcc4, pcc and clang):
> 
> 
> 
> Index: targ.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/make/targ.c,v
> retrieving revision 1.62
> diff -u -r1.62 targ.c
> --- targ.c    19 Jul 2010 19:46:44 -0000      1.62
> +++ targ.c    21 Sep 2011 09:35:31 -0000
> @@ -461,9 +461,3 @@
>  {
>       return &targets;
>  }
> -
> -GNode *
> -Targ_FindNodeh(const char *name, size_t n, uint32_t hv, int flags)
> -{
> -     return Targ_FindNodeih(name, name + n - 1, hv, flags);
> -}
> Index: targ.h
> ===================================================================
> RCS file: /cvs/src/usr.bin/make/targ.h,v
> retrieving revision 1.9
> diff -u -r1.9 targ.h
> --- targ.h    19 Jul 2010 19:46:44 -0000      1.9
> +++ targ.h    21 Sep 2011 09:35:31 -0000
> @@ -56,9 +56,9 @@
>  /* set of helpers for constant nodes */
>  extern GNode *Targ_FindNodeih(const char *, const char *, uint32_t, int);
>  
> -extern inline GNode *
> +static inline GNode *
>  Targ_FindNodeh(const char *, size_t, uint32_t, int);
> -extern inline GNode *
> +static inline GNode *
>  Targ_FindNodeh(const char *name, size_t n, uint32_t hv, int flags)
>  {
>       return Targ_FindNodeih(name, name + n - 1, hv, flags);

Reply via email to