[Bug d/87866] gdc fails to compile minimal test

2019-03-12 Thread ibuclaw at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87866

--- Comment #7 from ibuclaw at gcc dot gnu.org ---
Author: ibuclaw
Date: Tue Mar 12 16:31:48 2019
New Revision: 269619

URL: https://gcc.gnu.org/viewcvs?rev=269619=gcc=rev
Log:
Use libiberty's lrealpath to avoid portability problems.

The dmd front-end function FileName::canonicalName could be called
during the semantic pass of import("file") expressions, so still
requires that realpath() be redefined.

Initial patch by Rainer Orth.

gcc/d/ChangeLog:

2019-03-12  Iain Buclaw  

PR d/87866
* d-system.h (realpath): Redefine as lrealpath.

Modified:
trunk/gcc/d/ChangeLog
trunk/gcc/d/d-system.h

[Bug d/87866] gdc fails to compile minimal test

2018-11-25 Thread ro at CeBiTec dot Uni-Bielefeld.DE
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87866

--- Comment #6 from ro at CeBiTec dot Uni-Bielefeld.DE  ---
> --- Comment #5 from Iain Buclaw  ---
> Based on what you described is the problem, I think this is done.

I'm pretty certain it is.  I've successfully been using the following
similar patch for some time:

diff --git a/gcc/d/d-system.h b/gcc/d/d-system.h
--- a/gcc/d/d-system.h
+++ b/gcc/d/d-system.h
@@ -50,4 +50,8 @@
 #undef tolower
 #define tolower(c) TOLOWER(c)

+/* Use libiberty's lrealpath to avoid portability problems.  */
+#undef realpath
+#define realpath(a, b) lrealpath((a))
+
 #endif  /* GCC_D_SYSTEM_H  */

Thanks.
Rainer

[Bug d/87866] gdc fails to compile minimal test

2018-11-24 Thread ibuclaw at gdcproject dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87866

Iain Buclaw  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |FIXED

--- Comment #5 from Iain Buclaw  ---
Based on what you described is the problem, I think this is done.

[Bug d/87866] gdc fails to compile minimal test

2018-11-24 Thread ibuclaw at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87866

--- Comment #4 from ibuclaw at gcc dot gnu.org ---
Author: ibuclaw
Date: Sat Nov 24 09:51:03 2018
New Revision: 266429

URL: https://gcc.gnu.org/viewcvs?rev=266429=gcc=rev
Log:
gcc/d/ChangeLog:

2018-11-24  Iain Buclaw  

PR d/87866
* d-incpath.cc (add_globalpaths): Use lrealpath to get canonical name.
(add_filepaths): Likewise.

Modified:
trunk/gcc/d/ChangeLog
trunk/gcc/d/d-incpath.cc

[Bug d/87866] gdc fails to compile minimal test

2018-11-06 Thread ibuclaw at gdcproject dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87866

--- Comment #3 from Iain Buclaw  ---
(In reply to r...@cebitec.uni-bielefeld.de from comment #2)
> > --- Comment #1 from Iain Buclaw  ---
> > I backported a fix from the D sources so it should no longer segfault at 
> > least.
> 
> It doesn't indeed.
> 
> > From what I can see, it should pick up the object.d source correctly.
> >
> > -nostdinc -I /vol/gcc/src/hg/trunk/local/libphobos/libdruntime 
> >
> > Unless it really isn't in the -I path.
> 
> I've found what's going on:
> 
> When d-incpath.dd (add_globalpaths) calls into Filename::canonicalName
> (path), path is set correctly to the d21 -I arg:
> 
> 81const char *target = FileName::canonicalName (path);
> (gdb) p path
> $7 = 0x9f33878 "/vol/gcc/src/hg/trunk/local/libphobos/libdruntime"
> 
> (gdb) s
> 0x0833cea6 in FileName::canonicalName (
> name=0x9f33878 "/vol/gcc/src/hg/trunk/local/libphobos/libdruntime")
> at /vol/gcc/src/hg/trunk/local/gcc/d/dmd/root/filename.c:616
> 616 return realpath(name, NULL);
> (gdb) n
> 83if (target == NULL || !FileName::exists (target))
> (gdb) p target
> $8 = 0x0
> 
> However, canonicalPath returns with NULL.  I traced this to realpath(3C)
> on Solaris 10 behaving differently, as explained in the man page:
> 
>  bolic  links.  The  generated  pathname is stored as a null-
>  terminated string, up  to  a  maximum  of  {PATH_MAX}  bytes
>  (defined  in  limits.h(3HEAD)),  in the buffer pointed to by
>  resolved_name.
> 
> RETURN VALUES
>  On successful completion, realpath() returns  a  pointer  to
>  the  resolved  name.   Otherwise,  realpath() returns a null
>  pointer and sets errno to indicate the error, and  the  con-
>  tents  of the buffer pointed to by resolved_name are left in
>  an indeterminate state.
> 
> Unlike e.g. the Solaris 11.4 version, realpath doesn't allocate a buffer
> on it's own if the second arg is NULL, but given that it couldn't store
> the real path, returned NULL to indicate that failure.
> 
>   Rainer

OK, I guess I should be using libiberty here instead of the front-end's
provided FileName functions here, and probably in other places.

[Bug d/87866] gdc fails to compile minimal test

2018-11-06 Thread ro at CeBiTec dot Uni-Bielefeld.DE
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87866

--- Comment #2 from ro at CeBiTec dot Uni-Bielefeld.DE  ---
> --- Comment #1 from Iain Buclaw  ---
> I backported a fix from the D sources so it should no longer segfault at 
> least.

It doesn't indeed.

> From what I can see, it should pick up the object.d source correctly.
>
> -nostdinc -I /vol/gcc/src/hg/trunk/local/libphobos/libdruntime 
>
> Unless it really isn't in the -I path.

I've found what's going on:

When d-incpath.dd (add_globalpaths) calls into Filename::canonicalName
(path), path is set correctly to the d21 -I arg:

81const char *target = FileName::canonicalName (path);
(gdb) p path
$7 = 0x9f33878 "/vol/gcc/src/hg/trunk/local/libphobos/libdruntime"

(gdb) s
0x0833cea6 in FileName::canonicalName (
name=0x9f33878 "/vol/gcc/src/hg/trunk/local/libphobos/libdruntime")
at /vol/gcc/src/hg/trunk/local/gcc/d/dmd/root/filename.c:616
616 return realpath(name, NULL);
(gdb) n
83if (target == NULL || !FileName::exists (target))
(gdb) p target
$8 = 0x0

However, canonicalPath returns with NULL.  I traced this to realpath(3C)
on Solaris 10 behaving differently, as explained in the man page:

 bolic  links.  The  generated  pathname is stored as a null-
 terminated string, up  to  a  maximum  of  {PATH_MAX}  bytes
 (defined  in  limits.h(3HEAD)),  in the buffer pointed to by
 resolved_name.

RETURN VALUES
 On successful completion, realpath() returns  a  pointer  to
 the  resolved  name.   Otherwise,  realpath() returns a null
 pointer and sets errno to indicate the error, and  the  con-
 tents  of the buffer pointed to by resolved_name are left in
 an indeterminate state.

Unlike e.g. the Solaris 11.4 version, realpath doesn't allocate a buffer
on it's own if the second arg is NULL, but given that it couldn't store
the real path, returned NULL to indicate that failure.

Rainer

[Bug d/87866] gdc fails to compile minimal test

2018-11-04 Thread ibuclaw at gdcproject dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87866

--- Comment #1 from Iain Buclaw  ---
I backported a fix from the D sources so it should no longer segfault at least.

From what I can see, it should pick up the object.d source correctly.

-nostdinc -I /vol/gcc/src/hg/trunk/local/libphobos/libdruntime 

Unless it really isn't in the -I path.

[Bug d/87866] gdc fails to compile minimal test

2018-11-02 Thread ro at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87866

Rainer Orth  changed:

   What|Removed |Added

   Target Milestone|--- |9.0