Sysop: | Amessyroom |
---|---|
Location: | Fayetteville, NC |
Users: | 27 |
Nodes: | 6 (0 / 6) |
Uptime: | 38:51:38 |
Calls: | 631 |
Calls today: | 2 |
Files: | 1,187 |
D/L today: |
23 files (29,781K bytes) |
Messages: | 174,060 |
As I wrote I am trying to compile gcc-15 cross-compiler targeting
VMS. I now have trouble with libgfortran. Namely libgfortran
tries to use Posix compatiblity to perform some file operations.
I have trouble with st_ino filed in 'struct stat'. Code below
ilustrates the problem. I am getting warning from VMS C compiler:
mp->st_ino = sb.st_ino;
....^
%CC-W-CVTDIFTYPES, In this statement, "sb.st_ino" of type "pointer to unsigned s
hort", is being converted to "unsigned short".
mp->st_ino = sb.st_ino;
.................^
%CC-W-MAYLOSEDATA, In this statement, "sb.st_ino" has a larger data size than "u
nsigned short". Assignment can result in data loss.
While this is only a warning in VMS C, such thing may indicate serious problem. Also, I tried to print 'sizeof(sb.st_ino)' and
'sizeof(unsigned short *)'. The results are 6 and 4 respecitvely.
So size of type reported above does not match with size of 'sb.st_ino'.
#include <sys/stat.h>
typedef struct
{
/* Cached stat(2) values. */
dev_t st_dev;
ino_t st_ino;
long long file_size;
}
my_sb;
int
my_stat(const char * name, my_sb * mp) {
struct stat sb;
int res = stat(name, &sb);
mp->st_dev = sb.st_dev;
mp->st_ino = sb.st_ino;
mp->file_size = sb.st_size;
return res;
}
As I wrote I am trying to compile gcc-15 cross-compiler targeting
VMS. I now have trouble with libgfortran. Namely libgfortran
tries to use Posix compatiblity to perform some file operations.
I have trouble with st_ino filed in 'struct stat'. Code below
ilustrates the problem. I am getting warning from VMS C compiler:
mp->st_ino = sb.st_ino;
....^
%CC-W-CVTDIFTYPES, In this statement, "sb.st_ino" of type "pointer to unsigned s
hort", is being converted to "unsigned short".
mp->st_ino = sb.st_ino;
.................^
%CC-W-MAYLOSEDATA, In this statement, "sb.st_ino" has a larger data size than "u
nsigned short". Assignment can result in data loss.
While this is only a warning in VMS C, such thing may indicate serious >problem. Also, I tried to print 'sizeof(sb.st_ino)' and
'sizeof(unsigned short *)'. The results are 6 and 4 respecitvely.
So size of type reported above does not match with size of 'sb.st_ino'.
I am worried by this. And of course important question is if
'stat' works as described in Posix? I did not check Posix spec,
but I would expect that ino_t is supposed to be type of 'st_ino'
field of of 'struct stat', which apparently fails on VMS.
And fundamental thing: Posix promises that two files are in
fact the same file if and only if both 'st_dev' field and
'st_ino' fields match. And libgfortran depends on this.
Does it hold on VMS?
---------------<cut here>----------------------
#include <sys/stat.h>
typedef struct
{
/* Cached stat(2) values. */
dev_t st_dev;
ino_t st_ino;
long long file_size;
}
my_sb;
int
my_stat(const char * name, my_sb * mp) {
struct stat sb;
int res = stat(name, &sb);
mp->st_dev = sb.st_dev;
mp->st_ino = sb.st_ino;
mp->file_size = sb.st_size;
return res;
}
---------------<cut here>---------------
In article <109k6sf$3v9m4$1@paganini.bofh.team>,
Waldek Hebisch <antispam@fricas.org> wrote:
As I wrote I am trying to compile gcc-15 cross-compiler targeting
VMS. I now have trouble with libgfortran. Namely libgfortran
tries to use Posix compatiblity to perform some file operations.
I have trouble with st_ino filed in 'struct stat'. Code below
ilustrates the problem. I am getting warning from VMS C compiler:
mp->st_ino = sb.st_ino;
....^
%CC-W-CVTDIFTYPES, In this statement, "sb.st_ino" of type "pointer to unsigned s
hort", is being converted to "unsigned short".
mp->st_ino = sb.st_ino;
.................^
%CC-W-MAYLOSEDATA, In this statement, "sb.st_ino" has a larger data size than "u
nsigned short". Assignment can result in data loss.
While this is only a warning in VMS C, such thing may indicate serious >>problem. Also, I tried to print 'sizeof(sb.st_ino)' and
'sizeof(unsigned short *)'. The results are 6 and 4 respecitvely.
So size of type reported above does not match with size of 'sb.st_ino'.
The error message above is saying that `sb.st_ino` is a pointer; specifically, it's a `unsigned short *`, and that you're trying
to assign it to an unsigned short without indirecting. One
wonders what, `mp->st_ino = *sb.st_ino;` would do?
This doesn't look right to me, though. Clearly, file structures
on VMS do not have an "inode" in the same way that most of them
do on Unix, but if the field exists in the struct, it would.
Looking on Eisner, I see this:
```
$ search *.h ino_t
****************************** SYS$COMMON:[DECC$LIB.REFERENCE.DECC$RTLDEF]DECC$TYPES.H;2
typedef unsigned short __ino_t;
****************************** SYS$COMMON:[DECC$LIB.REFERENCE.DECC$RTLDEF]DIRENT.H;2
** The type ino_t is an _XOPEN_SOURCE extension.
# ifndef __INO_T
# define __INO_T
typedef __ino_t ino_t;
__ino_t d_ino[3]; /* file serial number (vms-style inode) */
****************************** SYS$COMMON:[DECC$LIB.REFERENCE.DECC$RTLDEF]STAT.H;2
# ifndef __INO_T
# define __INO_T 1
typedef __ino_t ino_t;
__ino_t st_ino[3]; /* 3 words to receive fid */
****************************** SYS$COMMON:[DECC$LIB.REFERENCE.DECC$RTLDEF]TYPES.H;2
#if !defined __INO_T && !defined _DECC_V4_SOURCE
# define __INO_T 1
typedef __ino_t ino_t;
$
```
So `st_ino` is really an _array_; note again the error message,
which just tells you the type that the compiler is working with
in the context of this assignment: that pointer type is due to C
making unadorned array accesses decay into pointers (an
historical artifact from the B language, where the `[]` syntax
was used for pointers as well as arrays), so the compiler turned
`.st_ino` into a pointer for this access and then complained
that you were assigning its value to an `unsigned short`.
I am worried by this. And of course important question is if
'stat' works as described in Posix? I did not check Posix spec,
but I would expect that ino_t is supposed to be type of 'st_ino'
field of of 'struct stat', which apparently fails on VMS.
It is. But on VMS, that type is an array, not a scalar.
However, POSIX mandates that `ino_t` is defined as an unsigned
integer type in `sys/types.h`, so VMS violates POSIX in this
regard. (https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/sys_types.h.html)
And fundamental thing: Posix promises that two files are in
fact the same file if and only if both 'st_dev' field and
'st_ino' fields match. And libgfortran depends on this.
Does it hold on VMS?
In what way does libgfortran really depend on that?
Perhaps start by building just C/C++ and skip Fortran for now?
Dan Cross <cross@spitfire.i.gajendra.net> wrote:
In article <109k6sf$3v9m4$1@paganini.bofh.team>,
Waldek Hebisch <antispam@fricas.org> wrote:
As I wrote I am trying to compile gcc-15 cross-compiler targeting
VMS. I now have trouble with libgfortran. Namely libgfortran
tries to use Posix compatiblity to perform some file operations.
I have trouble with st_ino filed in 'struct stat'. Code below
ilustrates the problem. I am getting warning from VMS C compiler:
mp->st_ino = sb.st_ino;
....^
%CC-W-CVTDIFTYPES, In this statement, "sb.st_ino" of type "pointer to unsigned s
hort", is being converted to "unsigned short".
mp->st_ino = sb.st_ino;
.................^
%CC-W-MAYLOSEDATA, In this statement, "sb.st_ino" has a larger data size than "u
nsigned short". Assignment can result in data loss.
While this is only a warning in VMS C, such thing may indicate serious >>>problem. Also, I tried to print 'sizeof(sb.st_ino)' and
'sizeof(unsigned short *)'. The results are 6 and 4 respecitvely.
So size of type reported above does not match with size of 'sb.st_ino'.
The error message above is saying that `sb.st_ino` is a pointer;
specifically, it's a `unsigned short *`, and that you're trying
to assign it to an unsigned short without indirecting. One
wonders what, `mp->st_ino = *sb.st_ino;` would do?
This doesn't look right to me, though. Clearly, file structures
on VMS do not have an "inode" in the same way that most of them
do on Unix, but if the field exists in the struct, it would.
Looking on Eisner, I see this:
```
$ search *.h ino_t
******************************
SYS$COMMON:[DECC$LIB.REFERENCE.DECC$RTLDEF]DECC$TYPES.H;2
typedef unsigned short __ino_t;
******************************
SYS$COMMON:[DECC$LIB.REFERENCE.DECC$RTLDEF]DIRENT.H;2
** The type ino_t is an _XOPEN_SOURCE extension.
# ifndef __INO_T
# define __INO_T
typedef __ino_t ino_t;
__ino_t d_ino[3]; /* file serial number (vms-style inode) */
******************************
SYS$COMMON:[DECC$LIB.REFERENCE.DECC$RTLDEF]STAT.H;2
# ifndef __INO_T
# define __INO_T 1
typedef __ino_t ino_t;
__ino_t st_ino[3]; /* 3 words to receive fid */
******************************
SYS$COMMON:[DECC$LIB.REFERENCE.DECC$RTLDEF]TYPES.H;2
#if !defined __INO_T && !defined _DECC_V4_SOURCE
# define __INO_T 1
typedef __ino_t ino_t;
$
```
So `st_ino` is really an _array_; note again the error message,
which just tells you the type that the compiler is working with
in the context of this assignment: that pointer type is due to C
making unadorned array accesses decay into pointers (an
historical artifact from the B language, where the `[]` syntax
was used for pointers as well as arrays), so the compiler turned
`.st_ino` into a pointer for this access and then complained
that you were assigning its value to an `unsigned short`.
I am worried by this. And of course important question is if
'stat' works as described in Posix? I did not check Posix spec,
but I would expect that ino_t is supposed to be type of 'st_ino'
field of of 'struct stat', which apparently fails on VMS.
It is. But on VMS, that type is an array, not a scalar.
However, POSIX mandates that `ino_t` is defined as an unsigned
integer type in `sys/types.h`, so VMS violates POSIX in this
regard.
(https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/sys_types.h.html)
Yes, I st_ino on VMS is an array. I have now modified libgfortran
to accomodate this.
And fundamental thing: Posix promises that two files are in
fact the same file if and only if both 'st_dev' field and
'st_ino' fields match. And libgfortran depends on this.
Does it hold on VMS?
In what way does libgfortran really depend on that?
libgfortran has function which should determine if two files
are in fact the same file. And it uses Posix features,
except for MinGW where thay use MinGW-specific method.
If that Posix feature fail, then correspondig function in
libgfortran will not work correctly.
Perhaps start by building just C/C++ and skip Fortran for now?
Well, C builds OK (I need to do extra work so that generated
binares have chance of working on VMS). C++ build waits for
resolution of binutils problems (only gas problem is critical to
build but probably it will be resolved only after other binutils
problems are resolved). Ada hits trouble very early (could be
because host has gcc/GNAT 12). So Fortran is natural place
to make progress.
On 9/7/2025 11:03 AM, Waldek Hebisch wrote:
As I wrote I am trying to compile gcc-15 cross-compiler targeting
VMS. I now have trouble with libgfortran. Namely libgfortran
tries to use Posix compatiblity to perform some file operations.
I have trouble with st_ino filed in 'struct stat'. Code below
ilustrates the problem. I am getting warning from VMS C compiler:
mp->st_ino = sb.st_ino;
....^
%CC-W-CVTDIFTYPES, In this statement, "sb.st_ino" of type "pointer to unsigned s
hort", is being converted to "unsigned short".
mp->st_ino = sb.st_ino;
.................^
%CC-W-MAYLOSEDATA, In this statement, "sb.st_ino" has a larger data size than "u
nsigned short". Assignment can result in data loss.
While this is only a warning in VMS C, such thing may indicate serious
problem. Also, I tried to print 'sizeof(sb.st_ino)' and
'sizeof(unsigned short *)'. The results are 6 and 4 respecitvely.
So size of type reported above does not match with size of 'sb.st_ino'.
#include <sys/stat.h>
typedef struct
{
/* Cached stat(2) values. */
dev_t st_dev;
ino_t st_ino;
long long file_size;
}
my_sb;
int
my_stat(const char * name, my_sb * mp) {
struct stat sb;
int res = stat(name, &sb);
mp->st_dev = sb.st_dev;
mp->st_ino = sb.st_ino;
mp->file_size = sb.st_size;
return res;
}
A VMS FID is 3 words, so 6 bytes seems right.
stat.h is a nightmare of #ifdef's.
I can see 2 approaches worth investigating.
A)
Change my_sb to:
__ino16_t st_ino[3];
and handle the array.
B)
Compile with:
/def="_USE_STD_STAT"
(then it looks like your code compiles)
I have no idea if any of them will work in the bigger context.
Dan Cross <cross@spitfire.i.gajendra.net> wrote:
In article <109k6sf$3v9m4$1@paganini.bofh.team>,
Waldek Hebisch <antispam@fricas.org> wrote:
As I wrote I am trying to compile gcc-15 cross-compiler targeting
VMS. I now have trouble with libgfortran. Namely libgfortran
tries to use Posix compatiblity to perform some file operations.
I have trouble with st_ino filed in 'struct stat'. Code below
ilustrates the problem. I am getting warning from VMS C compiler:
mp->st_ino = sb.st_ino;
....^
%CC-W-CVTDIFTYPES, In this statement, "sb.st_ino" of type "pointer to unsigned s
hort", is being converted to "unsigned short".
mp->st_ino = sb.st_ino;
.................^
%CC-W-MAYLOSEDATA, In this statement, "sb.st_ino" has a larger data size than "u
nsigned short". Assignment can result in data loss.
While this is only a warning in VMS C, such thing may indicate serious
problem. Also, I tried to print 'sizeof(sb.st_ino)' and
'sizeof(unsigned short *)'. The results are 6 and 4 respecitvely.
So size of type reported above does not match with size of 'sb.st_ino'.
The error message above is saying that `sb.st_ino` is a pointer;
specifically, it's a `unsigned short *`, and that you're trying
to assign it to an unsigned short without indirecting. One
wonders what, `mp->st_ino = *sb.st_ino;` would do?
This doesn't look right to me, though. Clearly, file structures
on VMS do not have an "inode" in the same way that most of them
do on Unix, but if the field exists in the struct, it would.
Looking on Eisner, I see this:
```
$ search *.h ino_t
******************************
SYS$COMMON:[DECC$LIB.REFERENCE.DECC$RTLDEF]DECC$TYPES.H;2
typedef unsigned short __ino_t;
******************************
SYS$COMMON:[DECC$LIB.REFERENCE.DECC$RTLDEF]DIRENT.H;2
** The type ino_t is an _XOPEN_SOURCE extension.
# ifndef __INO_T
# define __INO_T
typedef __ino_t ino_t;
__ino_t d_ino[3]; /* file serial number (vms-style inode) */
******************************
SYS$COMMON:[DECC$LIB.REFERENCE.DECC$RTLDEF]STAT.H;2
# ifndef __INO_T
# define __INO_T 1
typedef __ino_t ino_t;
__ino_t st_ino[3]; /* 3 words to receive fid */
******************************
SYS$COMMON:[DECC$LIB.REFERENCE.DECC$RTLDEF]TYPES.H;2
#if !defined __INO_T && !defined _DECC_V4_SOURCE
# define __INO_T 1
typedef __ino_t ino_t;
$
```
So `st_ino` is really an _array_; note again the error message,
which just tells you the type that the compiler is working with
in the context of this assignment: that pointer type is due to C
making unadorned array accesses decay into pointers (an
historical artifact from the B language, where the `[]` syntax
was used for pointers as well as arrays), so the compiler turned
`.st_ino` into a pointer for this access and then complained
that you were assigning its value to an `unsigned short`.
I am worried by this. And of course important question is if
'stat' works as described in Posix? I did not check Posix spec,
but I would expect that ino_t is supposed to be type of 'st_ino'
field of of 'struct stat', which apparently fails on VMS.
It is. But on VMS, that type is an array, not a scalar.
However, POSIX mandates that `ino_t` is defined as an unsigned
integer type in `sys/types.h`, so VMS violates POSIX in this
regard.
(https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/sys_types.h.html)
Yes, I st_ino on VMS is an array. I have now modified libgfortran
to accomodate this.
If st_ino is an integral type, then I think the answer is yes. If it'sAnd fundamental thing: Posix promises that two files are in
fact the same file if and only if both 'st_dev' field and
'st_ino' fields match. And libgfortran depends on this.
Does it hold on VMS?
You definitely want _USE_STD_STAT for anything new and/or
cross-platform.
That gets you something that was POSIX-compliant a decade or two
ago. It isn't compliant now because the file times are still just
ints rather than structs with high-precision components as newer
POSIX requires.
If st_ino is an integral type, then I think the answer is yes.-a If it'sWaldek Hebisch <antispam@fricas.org> wrote:
And fundamental thing: Posix promises that two files are in
fact the same file if and only if both 'st_dev' field and
'st_ino' fields match.-a And libgfortran depends on this.
Does it hold on VMS?
the array type, then it probably depends on who's doing the comparisons.
If you pass the stat structure to existing code that does the
comparison, it may or may not handle the array correctly.
On 9/7/2025 5:33 PM, Craig A. Berry wrote:
If st_ino is an integral type, then I think the answer is yes.-a If it'sWaldek Hebisch <antispam@fricas.org> wrote:
And fundamental thing: Posix promises that two files are in
fact the same file if and only if both 'st_dev' field and
'st_ino' fields match.-a And libgfortran depends on this.
Does it hold on VMS?
the array type, then it probably depends on who's doing the comparisons.
If you pass the stat structure to existing code that does the
comparison, it may or may not handle the array correctly.
I believe it contains FID.
Same disk and same FID must mean same file.
Different file must mean either different disk or different FID.
So either 3 comparisons of int16_t or one comparison of int64_t
should do it. Assuming that the last 16 bit of the int64_t always
has same value (like 0).
Well, C builds OK (I need to do extra work so that generated
binares have chance of working on VMS). C++ build waits for
resolution of binutils problems (only gas problem is critical to
build but probably it will be resolved only after other binutils
problems are resolved). Ada hits trouble very early (could be
because host has gcc/GNAT 12). So Fortran is natural place
to make progress.
On 9/7/25 1:17 PM, Waldek Hebisch wrote:
Dan Cross <cross@spitfire.i.gajendra.net> wrote:
In article <109k6sf$3v9m4$1@paganini.bofh.team>,
Waldek Hebisch <antispam@fricas.org> wrote:
As I wrote I am trying to compile gcc-15 cross-compiler targetingThe error message above is saying that `sb.st_ino` is a pointer;
VMS. I now have trouble with libgfortran. Namely libgfortran
tries to use Posix compatiblity to perform some file operations.
I have trouble with st_ino filed in 'struct stat'. Code below
ilustrates the problem. I am getting warning from VMS C compiler:
mp->st_ino = sb.st_ino;
....^
%CC-W-CVTDIFTYPES, In this statement, "sb.st_ino" of type "pointer to unsigned s
hort", is being converted to "unsigned short".
mp->st_ino = sb.st_ino;
.................^
%CC-W-MAYLOSEDATA, In this statement, "sb.st_ino" has a larger data size than "u
nsigned short". Assignment can result in data loss.
While this is only a warning in VMS C, such thing may indicate serious >>>> problem. Also, I tried to print 'sizeof(sb.st_ino)' and
'sizeof(unsigned short *)'. The results are 6 and 4 respecitvely.
So size of type reported above does not match with size of 'sb.st_ino'. >>>
specifically, it's a `unsigned short *`, and that you're trying
to assign it to an unsigned short without indirecting. One
wonders what, `mp->st_ino = *sb.st_ino;` would do?
This doesn't look right to me, though. Clearly, file structures
on VMS do not have an "inode" in the same way that most of them
do on Unix, but if the field exists in the struct, it would.
Looking on Eisner, I see this:
```
$ search *.h ino_t
******************************
SYS$COMMON:[DECC$LIB.REFERENCE.DECC$RTLDEF]DECC$TYPES.H;2
typedef unsigned short __ino_t;
******************************
SYS$COMMON:[DECC$LIB.REFERENCE.DECC$RTLDEF]DIRENT.H;2
** The type ino_t is an _XOPEN_SOURCE extension.
# ifndef __INO_T
# define __INO_T
typedef __ino_t ino_t;
__ino_t d_ino[3]; /* file serial number (vms-style inode) */
******************************
SYS$COMMON:[DECC$LIB.REFERENCE.DECC$RTLDEF]STAT.H;2
# ifndef __INO_T
# define __INO_T 1
typedef __ino_t ino_t;
__ino_t st_ino[3]; /* 3 words to receive fid */
******************************
SYS$COMMON:[DECC$LIB.REFERENCE.DECC$RTLDEF]TYPES.H;2
#if !defined __INO_T && !defined _DECC_V4_SOURCE
# define __INO_T 1
typedef __ino_t ino_t;
$
```
So `st_ino` is really an _array_; note again the error message,
which just tells you the type that the compiler is working with
in the context of this assignment: that pointer type is due to C
making unadorned array accesses decay into pointers (an
historical artifact from the B language, where the `[]` syntax
was used for pointers as well as arrays), so the compiler turned
`.st_ino` into a pointer for this access and then complained
that you were assigning its value to an `unsigned short`.
I am worried by this. And of course important question is if
'stat' works as described in Posix? I did not check Posix spec,
but I would expect that ino_t is supposed to be type of 'st_ino'
field of of 'struct stat', which apparently fails on VMS.
It is. But on VMS, that type is an array, not a scalar.
However, POSIX mandates that `ino_t` is defined as an unsigned
integer type in `sys/types.h`, so VMS violates POSIX in this
regard.
(https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/sys_types.h.html)
Yes, I st_ino on VMS is an array. I have now modified libgfortran
to accomodate this.
Yes and no. If you insist on using decades-old VAX C compatibility
features, then st_ino is an array. Probably because you couldn't fit 3
words into any integral type on VAX.
If you define _USE_STD_STAT, though, then you get:
typedef unsigned __int64 __ino_t;
typedef __ino_t ino_t;
You also get large file support, which you could get independently via _LARGEFILE if for some reason you had to. You definitely want
_USE_STD_STAT for anything new and/or cross-platform. That gets you something that was POSIX-compliant a decade or two ago. It isn't
compliant now because the file times are still just ints rather than
structs with high-precision components as newer POSIX requires.
If st_ino is an integral type, then I think the answer is yes. If it'sAnd fundamental thing: Posix promises that two files are in
fact the same file if and only if both 'st_dev' field and
'st_ino' fields match. And libgfortran depends on this.
Does it hold on VMS?
the array type, then it probably depends on who's doing the comparisons.
If you pass the stat structure to existing code that does the
comparison, it may or may not handle the array correctly.
Perl has bent over backwards to try to get around this very ino_t problem:
<https://github.com/Perl/perl5/blob/feb2c501977cb47f91dc5fc057341dc3f793cc86/vms/vmsish.h#L546>
I'm not saying you want to do the same thing (in fact really hope you
don't) but the comments there may illustrate the mess you have to wade through if you try to avoid using a slightly more modern stat struct.
Craig A. Berry <craigberry@nospam.mac.com> wrote:
On 9/7/25 1:17 PM, Waldek Hebisch wrote:
Yes, I st_ino on VMS is an array. I have now modified libgfortran
to accomodate this.
Yes and no. If you insist on using decades-old VAX C compatibility
features, then st_ino is an array. Probably because you couldn't fit 3
words into any integral type on VAX.
If you define _USE_STD_STAT, though, then you get:
typedef unsigned __int64 __ino_t;
typedef __ino_t ino_t;
You also get large file support, which you could get independently via
_LARGEFILE if for some reason you had to. You definitely want
_USE_STD_STAT for anything new and/or cross-platform. That gets you
something that was POSIX-compliant a decade or two ago. It isn't
compliant now because the file times are still just ints rather than
structs with high-precision components as newer POSIX requires.
Well, the contex is libgfortran, part of Fortran compiler. It is
supposed to work with 60 years old Fortran code. Such code may need compatiblity features.
ATM I did not look if/how gcc supports such switches. This isAssuming you've copied the VMS headers over to Linux where you are
certainly thing to look at later, but now I want old stuff to
work, when this works I can look at newer things.
On 9/8/25 9:05 PM, Waldek Hebisch wrote:
ATM I did not look if/how gcc supports such switches. This isAssuming you've copied the VMS headers over to Linux where you are
certainly thing to look at later, but now I want old stuff to
work, when this works I can look at newer things.
building the compiler, the switch would just be -D_USE_STD_STAT.
Craig A. Berry <craigberry@nospam.mac.com> wrote:
On 9/7/25 1:17 PM, Waldek Hebisch wrote:
[snip]
Yes, I st_ino on VMS is an array. I have now modified libgfortran
to accomodate this.
Yes and no. If you insist on using decades-old VAX C compatibility
features, then st_ino is an array. Probably because you couldn't fit 3
words into any integral type on VAX.
If you define _USE_STD_STAT, though, then you get:
typedef unsigned __int64 __ino_t;
typedef __ino_t ino_t;
You also get large file support, which you could get independently via
_LARGEFILE if for some reason you had to. You definitely want
_USE_STD_STAT for anything new and/or cross-platform. That gets you
something that was POSIX-compliant a decade or two ago. It isn't
compliant now because the file times are still just ints rather than
structs with high-precision components as newer POSIX requires.
Well, the contex is libgfortran, part of Fortran compiler. It is
supposed to work with 60 years old Fortran code. Such code may need >compatiblity features.
ATM I did not look if/how gcc supports such switches. This is
certainly thing to look at later, but now I want old stuff to
work, when this works I can look at newer things.
On 2025-09-09, Craig A. Berry <craigberry@nospam.mac.com> wrote:
On 9/8/25 9:05 PM, Waldek Hebisch wrote:
ATM I did not look if/how gcc supports such switches. This isAssuming you've copied the VMS headers over to Linux where you are
certainly thing to look at later, but now I want old stuff to
work, when this works I can look at newer things.
building the compiler, the switch would just be -D_USE_STD_STAT.
Copying the headers is what I did (with patches afterwards IIRC).
Waldek OTOH said that he was creating his own headers. I don't know
if that is still the case.
BTW, according to the messages I posted at the time, Waldek's C++
build failure is identical to the one I experienced so clearly
nothing has changed in this area since then.
In article <109o21i$g12m$1@paganini.bofh.team>,
Waldek Hebisch <antispam@fricas.org> wrote:
Craig A. Berry <craigberry@nospam.mac.com> wrote:
On 9/7/25 1:17 PM, Waldek Hebisch wrote:
[snip]
Yes, I st_ino on VMS is an array. I have now modified libgfortran
to accomodate this.
Yes and no. If you insist on using decades-old VAX C compatibility
features, then st_ino is an array. Probably because you couldn't fit 3
words into any integral type on VAX.
If you define _USE_STD_STAT, though, then you get:
typedef unsigned __int64 __ino_t;
typedef __ino_t ino_t;
You also get large file support, which you could get independently via
_LARGEFILE if for some reason you had to. You definitely want
_USE_STD_STAT for anything new and/or cross-platform. That gets you
something that was POSIX-compliant a decade or two ago. It isn't
compliant now because the file times are still just ints rather than
structs with high-precision components as newer POSIX requires.
Well, the contex is libgfortran, part of Fortran compiler. It is
supposed to work with 60 years old Fortran code. Such code may need
compatiblity features.
This gets back to my original question: not all code in
libgfortran is created the same. I doubt that 60-year old code
cares about doing inode number+device equality to determine
uniqueness of a file on a Unix system...particularly as Unix did
not exist 60 years ago.
Some code _may_ need that. My guess is that 99.99% wouldn't
care and you can hack it for now to make forward progress.
On 9/9/2025 12:26 PM, Dan Cross wrote:
In article <109o21i$g12m$1@paganini.bofh.team>,
Waldek Hebisch <antispam@fricas.org> wrote:
[snip]
Well, the contex is libgfortran, part of Fortran compiler. It is
supposed to work with 60 years old Fortran code. Such code may need
compatiblity features.
This gets back to my original question: not all code in
libgfortran is created the same. I doubt that 60-year old code
cares about doing inode number+device equality to determine
uniqueness of a file on a Unix system...particularly as Unix did
not exist 60 years ago.
Some code _may_ need that. My guess is that 99.99% wouldn't
care and you can hack it for now to make forward progress.
I suspect it is a standard compliance thing.
Fortran 77 standard says about open:
<quote>
If the file to be connected to the unit is not the same as the file to
which the unit is connected....
In article <109o21i$g12m$1@paganini.bofh.team>,
Waldek Hebisch <antispam@fricas.org> wrote:
Craig A. Berry <craigberry@nospam.mac.com> wrote:
On 9/7/25 1:17 PM, Waldek Hebisch wrote:
[snip]
Yes, I st_ino on VMS is an array. I have now modified libgfortran
to accomodate this.
Yes and no. If you insist on using decades-old VAX C compatibility
features, then st_ino is an array. Probably because you couldn't fit 3
words into any integral type on VAX.
If you define _USE_STD_STAT, though, then you get:
typedef unsigned __int64 __ino_t;
typedef __ino_t ino_t;
You also get large file support, which you could get independently via
_LARGEFILE if for some reason you had to. You definitely want
_USE_STD_STAT for anything new and/or cross-platform. That gets you
something that was POSIX-compliant a decade or two ago. It isn't
compliant now because the file times are still just ints rather than
structs with high-precision components as newer POSIX requires.
Well, the contex is libgfortran, part of Fortran compiler. It is
supposed to work with 60 years old Fortran code. Such code may need >>compatiblity features.
This gets back to my original question: not all code in
libgfortran is created the same. I doubt that 60-year old code
cares about doing inode number+device equality to determine
uniqueness of a file on a Unix system...particularly as Unix did
not exist 60 years ago.
Some code _may_ need that. My guess is that 99.99% wouldn't
care and you can hack it for now to make forward progress.
ATM I did not look if/how gcc supports such switches. This is
certainly thing to look at later, but now I want old stuff to
work, when this works I can look at newer things.
You'd just add `-D_USE_STD_STAT` as an additional compiler
argument when building libgfortran, no?
On 9/8/25 9:05 PM, Waldek Hebisch wrote:
Craig A. Berry <craigberry@nospam.mac.com> wrote:
On 9/7/25 1:17 PM, Waldek Hebisch wrote:
Yes, I st_ino on VMS is an array. I have now modified libgfortran
to accomodate this.
Yes and no. If you insist on using decades-old VAX C compatibility
features, then st_ino is an array. Probably because you couldn't fit 3
words into any integral type on VAX.
If you define _USE_STD_STAT, though, then you get:
typedef unsigned __int64 __ino_t;
typedef __ino_t ino_t;
You also get large file support, which you could get independently via
_LARGEFILE if for some reason you had to. You definitely want
_USE_STD_STAT for anything new and/or cross-platform. That gets you
something that was POSIX-compliant a decade or two ago. It isn't
compliant now because the file times are still just ints rather than
structs with high-precision components as newer POSIX requires.
Well, the contex is libgfortran, part of Fortran compiler. It is
supposed to work with 60 years old Fortran code. Such code may need
compatiblity features.
I'm not sure I follow; that sounds like a conflation of compiler build
time and compiler run time (user source build time) requirements.
Simon Clubley <clubley@remove_me.eisner.decus.org-earth.ufp> wrote:
On 2025-09-09, Craig A. Berry <craigberry@nospam.mac.com> wrote:
Assuming you've copied the VMS headers over to Linux where you are
building the compiler, the switch would just be -D_USE_STD_STAT.
Copying the headers is what I did (with patches afterwards IIRC).
Waldek OTOH said that he was creating his own headers. I don't know
if that is still the case.
I am using my own headers and my own (fake) libraries. Because
may fakes are static libraries the resulting binary has no
chance of working. I need to work out how to generate fake
shared images, then binaries linked to fake libraries when
transfed to VMS will use real libraries from the system and should
work.
BTW, according to the messages I posted at the time, Waldek's C++
build failure is identical to the one I experienced so clearly
nothing has changed in this area since then.
I have now fix or workaround for this issue, so build goes further.
But I get different assembler error at later stage.
Dan Cross <cross@spitfire.i.gajendra.net> wrote:
In article <109o21i$g12m$1@paganini.bofh.team>,
Waldek Hebisch <antispam@fricas.org> wrote:
Craig A. Berry <craigberry@nospam.mac.com> wrote:
On 9/7/25 1:17 PM, Waldek Hebisch wrote:
[snip]
Yes, I st_ino on VMS is an array. I have now modified libgfortran
to accomodate this.
Yes and no. If you insist on using decades-old VAX C compatibility
features, then st_ino is an array. Probably because you couldn't fit 3 >>>> words into any integral type on VAX.
If you define _USE_STD_STAT, though, then you get:
typedef unsigned __int64 __ino_t;
typedef __ino_t ino_t;
You also get large file support, which you could get independently via >>>> _LARGEFILE if for some reason you had to. You definitely want
_USE_STD_STAT for anything new and/or cross-platform. That gets you
something that was POSIX-compliant a decade or two ago. It isn't
compliant now because the file times are still just ints rather than
structs with high-precision components as newer POSIX requires.
Well, the contex is libgfortran, part of Fortran compiler. It is >>>supposed to work with 60 years old Fortran code. Such code may need >>>compatiblity features.
This gets back to my original question: not all code in
libgfortran is created the same. I doubt that 60-year old code
cares about doing inode number+device equality to determine
uniqueness of a file on a Unix system...particularly as Unix did
not exist 60 years ago.
Some code _may_ need that. My guess is that 99.99% wouldn't
care and you can hack it for now to make forward progress.
ATM I have single unconditional setup. I made progress,
after changing 'st_ino' in header file be an array and
small change to gfortran sources gfortran build works.
ATM I did not look if/how gcc supports such switches. This is
certainly thing to look at later, but now I want old stuff to
work, when this works I can look at newer things.
You'd just add `-D_USE_STD_STAT` as an additional compiler
argument when building libgfortran, no?
Unfortunately, within GCC build this is "hard way". Options
are set by configure machinery and this is brittle and time
consuming to test. Comparatively, changes to source files
are easy.
On 2025-09-09, Waldek Hebisch <antispam@fricas.org> wrote:
Simon Clubley <clubley@remove_me.eisner.decus.org-earth.ufp> wrote:
On 2025-09-09, Craig A. Berry <craigberry@nospam.mac.com> wrote:
Assuming you've copied the VMS headers over to Linux where you are
building the compiler, the switch would just be -D_USE_STD_STAT.
Copying the headers is what I did (with patches afterwards IIRC).
Waldek OTOH said that he was creating his own headers. I don't know
if that is still the case.
I am using my own headers and my own (fake) libraries. Because
may fakes are static libraries the resulting binary has no
chance of working. I need to work out how to generate fake
shared images, then binaries linked to fake libraries when
transfed to VMS will use real libraries from the system and should
work.
I can see how you might be able to get this working with sharable
images, but I am not seeing how you might get this working with
.olb object module libraries, given that the contents are linked into
the executable during linking and are not referenced at runtime.
Unless there's something I am not seeing, that would mean the actual
link would have to be done on VMS, and that you couldn't use binutils
on Linux to create the actual VMS Alpha executable image.
BTW, according to the messages I posted at the time, Waldek's C++
build failure is identical to the one I experienced so clearly
nothing has changed in this area since then.
I have now fix or workaround for this issue, so build goes further.
But I get different assembler error at later stage.
Nice to see progress on C++. That means you have got further than
I did with C++.
By default GNU ld also wants to use 'starlet.olb' and
'sys$public_vectors'. I do not know if 'starlet.olb' is a "shared
image library" or just static library. IIUC 'sys$public_vectors'
is a sharable image. So at least programs that do not use
'starlet.olb' should work after linking with fake shareable
images. And I think that this includes a lot of code.
Options are set by configure machinery and this is brittle and time
consuming to test.
On 9/10/25 16:13, Waldek Hebisch wrote:
By default GNU ld also wants to use 'starlet.olb' and
'sys$public_vectors'. I do not know if 'starlet.olb' is a "shared
image library" or just static library. IIUC 'sys$public_vectors'
is a sharable image. So at least programs that do not use
'starlet.olb' should work after linking with fake shareable
images. And I think that this includes a lot of code.
starlet.olb is an OBJECT library.
You can fake the shareable image. You only need to have the very same
symbol vector entries in the faked image as in the real one. That
includes all the alias entries as well has spare and private entries.
And you need to have the identical GSMATCH.
If someone links /system you also need a SYS$BASE_IMAGE.EXE. A faked one should do, but I admit I never tried that.
I have noticed that VMS linker inserts reference to 'LIB$INITIALIZE',
while with my fake libraries GNU linker does not reference this
function.
I have made a simple-minded generator of fake shared libraries.
Using fake 'DECC$SHR.exe' containing just 5 real symbols (and
hundreds of dummies to fill unused positions in symbol vector)
I managed to link on Linux a simple "Hello from VMS" program
and the program run correctly on VMS.
I still have a problem: ATM I do not know how access to variables in
shared images works. So I have bogus reference to 'C$_EXIT1'.
I have noticed that VMS linker inserts reference to 'LIB$INITIALIZE',
while with my fake libraries GNU linker does not reference this
function.
On 9/16/25 21:24, Waldek Hebisch wrote:
I have made a simple-minded generator of fake shared libraries.
Using fake 'DECC$SHR.exe' containing just 5 real symbols (and
hundreds of dummies to fill unused positions in symbol vector)
I managed to link on Linux a simple "Hello from VMS" program
and the program run correctly on VMS.
I still have a problem: ATM I do not know how access to variables in
shared images works. So I have bogus reference to 'C$_EXIT1'.
I don't see C$_EXIT1 in DECC$SHR on Alpha (Eisner, V8.4-2L2).
C$_ are message codes, for example C$_ENOENT (%C-F-ENOENT, no such file
or directory). That is integer literals.
Read/write data symbols are as procedure symbols with EGSY$V_NORM clear. Literals symbols are as data with EGSY$V_REL clear.
Create a small shareable image on VMS/Alpha with a procedure, data and
an integer literal and you will see the flags and the differences in the values. With analyze/image or a full map you should be able to find the symbol vector in dump's output.
I have noticed that VMS linker inserts reference to 'LIB$INITIALIZE',
while with my fake libraries GNU linker does not reference this
function.
The linker does not insert such a reference. If the LIB$INITIALIZE
module is included in the image, then it was explicitly included or
there was a reference to a symbol defined in this module from one of the
to be linked object modules.
I have noticed that VMS linker inserts reference to 'LIB$INITIALIZE',
while with my fake libraries GNU linker does not reference this
function.
The linker does not insert such a reference. If the LIB$INITIALIZE
module is included in the image, then it was explicitly included or
there was a reference to a symbol defined in this module from one of the
to be linked object modules.
Well, I tried:
$ link CRT0.OBJ,CRTBEGIN.OBJ,HH.OBJ,crtend.obj,hh.opt/options /NOSYSLIB
where hh.opt specifies linking with DECC$SHR.EXE and SYS$PUBLIC_VECTORS.EXE and linker complains about C$_EXIT1 and LIB$INITIALIZE being undefined.
My object files have only 5 external references, 4 are resolved by DECC$SHR.EXE. C$_EXIT1 is referenced in CRT0.OBJ and defined by
something in STARLET.OLB, but since I do not include STARLET.OLB in
the link linker should complain. But there is no reference to
LIB$INITIALIZE in the object files above. IIUC VMS shared libraries
are "fully linked", that is normally shared library should not cause reference to some extra symbol. But LIB$INITIALIZE apparently is
special. When I skip shared libraries from the link I get information
about 5 unresolved symbols, so clearly referenct to LIB$INITIALIZE
is triggered by linking shared libraries.
BTW: I included SYS$PUBLIC_VECTORS.EXE in the link because after
default linking executable references both DECC$SHR.EXE and SYS$PUBLIC_VECTORS.EXE. In particular executable uses slot
number 282 in symbol vector of SYS$PUBLIC_VECTORS.EXE. This
slot does not correspond to any function from official list
of system services, so I suspected that this may be
LIB$INITIALIZE. But apparently LIB$INITIALIZE is in STARLET.OLB
and uses some unknown system service.
On 9/18/25 2:55 AM, Waldek Hebisch wrote:
I have noticed that VMS linker inserts reference to 'LIB$INITIALIZE',
while with my fake libraries GNU linker does not reference this
function.
The linker does not insert such a reference. If the LIB$INITIALIZE
module is included in the image, then it was explicitly included or
there was a reference to a symbol defined in this module from one of the >>> to be linked object modules.
Well, I tried:
$ link CRT0.OBJ,CRTBEGIN.OBJ,HH.OBJ,crtend.obj,hh.opt/options /NOSYSLIB
It gets hairy or confusing or both ...
I assume the link was on VMS with object created with the binutils (on a non-VMS system). The 0 and BEGIN indicate that there is something that
needs to be done at program start. (On my Linux system there is a
crtbegin.o and that contains a section .init_array, the equivalent ELF section of the LIB$INITIALIZE PSECT.
where hh.opt specifies linking with DECC$SHR.EXE and SYS$PUBLIC_VECTORS.EXE >> and linker complains about C$_EXIT1 and LIB$INITIALIZE being undefined.
My object files have only 5 external references, 4 are resolved by
DECC$SHR.EXE. C$_EXIT1 is referenced in CRT0.OBJ and defined by
something in STARLET.OLB, but since I do not include STARLET.OLB in
the link linker should complain. But there is no reference to
LIB$INITIALIZE in the object files above.
IIUC VMS shared libraries
are "fully linked", that is normally shared library should not cause
reference to some extra symbol. But LIB$INITIALIZE apparently is
special. When I skip shared libraries from the link I get information
about 5 unresolved symbols, so clearly referenct to LIB$INITIALIZE
is triggered by linking shared libraries.
LIB$INITIALIZE is a "normal" PSECT (and symbol and module name - just to confuse ...). The PSECT contains the addresses of the functions to be
called at init time. Referencing the symbol is just a common hack/trick
to trigger inclusion of the module. The (user) code should do noting at
all with whatever the symbol references.
If you link on VMS, create a full map with cross references and you will
see what references LIB$INITIALIZE. The current binutils ld can also
create map files with references.
BTW: I included SYS$PUBLIC_VECTORS.EXE in the link because after
default linking executable references both DECC$SHR.EXE and
SYS$PUBLIC_VECTORS.EXE. In particular executable uses slot
number 282 in symbol vector of SYS$PUBLIC_VECTORS.EXE. This
slot does not correspond to any function from official list
of system services, so I suspected that this may be
LIB$INITIALIZE. But apparently LIB$INITIALIZE is in STARLET.OLB
and uses some unknown system service.
On Eisner, entry 282 in SYS$PUBLIC_VECTORS is SYS$NATIVE_TO_TRANSLATED.
And yes, that's not an official system service.
When I skipped SYS$PUBLIC_VECTORS.EXE from the link VMS linker
complained about missine SYS$IMGSTA, so for a moment I thought that
slot number 282 corresponds to SYS$IMGSTA. But testing shows that
SYS$IMGSTA corresponds to slot 52 and SYS$NATIVE_TO_TRANSLATED
indeed corresponds to slot 282.
CRT0.OBJ, CRTBEGIN.OBJ and CRTEND.OBJ are "standard" gcc files.
Sources are included in gcc tarball, but are a bit hairy due to
multiple conditionals.
Point is that using GNU linker those file just require 5 symbols:
main, decc$main, decc$malloc, decc$atexit and C$_EXIT1. main is
provided by HH.OBJ and in turn needs decc$puts. Using
GHU linker on Linux and a fake library exportingh the 5 symbols
above those files links fine and resulting executable runs on
VMS. CRTBEGIN.OBJ and crtend.obj contain reference to
LIB$INITIALIZE. But somewhat GNU linker treats it as "weak"
reference and does not complain that LIB$INITIALIZE is absent.
Apparently VMS linker insists on its presence.
AFAIK CRTBEGIN.OBJ is responsible for program initialization, in
particular for running things marked as 'constructors'. CRTEND.OBJ
is resposible for finalization.