Search for the environment variable in the envp string passed to
ProgramStart. This will only work if ProgramStart was actually called,
i.e. if the main program is Fortran.
Details
Details
Diff Detail
Diff Detail
Event Timeline
flang/runtime/command.cpp | ||
---|---|---|
86 | This will fail badly when the entire name is blank. | |
flang/runtime/environment.cpp | ||
74 | This won't work at all if ProgramStart is never called, and it won't be called when the main program is not Fortran. You need to test envp for validity and deal with the case of it being null. |
Comment Actions
Fixed. I'm working on a follow-up patch to call std::getenv if we don't find anything in envp. Does that sound good?
Comment Actions
Please implement a getenv path for the case without envp, or put a big TODO comment about it in the place where it needs to go. It might be easiest to simply implement it.
This will fail badly when the entire name is blank.