Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example of TestCase won't work on my system #3

Open
lsoranco opened this issue Mar 27, 2023 · 4 comments
Open

Example of TestCase won't work on my system #3

lsoranco opened this issue Mar 27, 2023 · 4 comments

Comments

@lsoranco
Copy link

The following error comes up when I try to compile:

error #6053: Structure constructor may not have fields with the PRIVATE attribute [NAME]

I am not using CMake, and I am creating my own vfproj in Microsoft Visual Studio 2010

@thomasms
Copy link
Owner

Hi there, I haven't tried it with Visual Studio 2010 before, nor do I have a version locally, so it will be hard for me to diagnose, but could you perhaps indicate what compiler you're using? Would that be Intel by any chance?

Any additional information you could provide would be helpful i.e. compilation log, versions, etc.

@lsoranco
Copy link
Author

Yes, I am using Intel(R) Visual Fortran Compiler XE 14.0.6.241 [IA-32]

As a complete IDE there are several options one can set in Microsoft Visual Studio 2010. What I can show you is the final command line the software is generating. I've changed some file locations, but it should give you the general idea of what is happening:

/nologo /debug:full /Od /fpp /I"./toast/toast/include" /I"./toast/external/json-fortran/lib/win32" /I"C:\my_local_lib\test\toast\external\json-fortran\visual_studio\jsonfortranlib\../../lib/win32" /warn:interfaces /module:"Debug\\" /object:"Debug\\" /Fd"Debug\vc100.pdb" /traceback /check:bounds /check:stack /libs:dll /threads /dbglibs /c

The solution I found as a work around is to create a personalized interface for my extension of TestCase, and define the name that will be print in the procedure of that interface. Here are the relevant snipets:

        procedure MyFunctionTestConstructor
    end interface
! ...

        function MyFunctionTestConstructor()
            type(MyFunctionTest) :: MyFunctionTestConstructor
            call MyFunctionTest%TestCase%init("MY NAME")
        end function MyFunctionTestConstructor```

@thomasms
Copy link
Owner

OK, so this looks like a bug for older compiliers. From what I can see XE 14.0.6.241 (https://en.wikipedia.org/wiki/Intel_Fortran_Compiler) didn't have full 2003 support, this could be the reason, I am guessing. Toast only supports 2003+ compilers, since I wanted a more modern library.

As you have discovered there are work arounds indeed for these not fully 2003 compliant compilers.
Have you tried more modern fortran compilers either gfortran or Intels OneAPI ifort?

Perhaps you could open a PR, or we could potentially discuss a fix for older compilers? I would need a fully reproducible toy example though before I can begin to fix this bug :).

@lsoranco
Copy link
Author

Oh...I see...I don't think I have (yet) enough expertise in Fortran to solve this kind of issues when it is something so subtle (small differences between standards/compilers). I will try to see what I can do about using a more modern compiler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants