[Openmp-commits] [PATCH] D65285: [OpenMP] Rename last file to cpp and remove LIBOMP_CFLAGS
Jonas Hahnfeld via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Sat Aug 3 04:51:14 PDT 2019
Hahnfeld added a comment.
Apologies, but I think my fix for `-Wcast-qual` is wrong and the code is still broken. Luckily, the latest Intel Compiler still warns about it which forced me to rethink what the pointers try to achieve.
At the moment, I'm inclined to say that the cast from the array `dll_path` to a pointer (or more precisely, from `&dll_path` to `const char **`) not only drops qualifiers, but isn't type correct either:
#include <cstdio>
static const char var[8] = { 0, 1, 2, 3, 4, 5, 6, 7 };
int main() {
const char **p = (const char **)&var;
printf("%p\n", *p);
}
Compiled with the latest GCC 9.1, this gives me: `0x706050403020100`
So `*p` is not a pointer to `const char *`, but it already is the array of `const char` and the program aborts if you try to dereference it further. This currently happens to work with `dll_path` because
1. it is initialized by 0, and
2. `PATH_MAX` is larger than the size of a pointer.
So `&dll_path` is effectively a pointer to `NULL`.
For the correct solution, could you point me to code that uses the `dll_path_ptr` member? Given that there were no problem with `static const char dll_path[PATH_MAX]` I guess it never assigns to `*dll_path_ptr`, but then I don't fully understand why it needs a pointer to a pointer...
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65285/new/
https://reviews.llvm.org/D65285
More information about the Openmp-commits
mailing list