Bug 25015 - [gomp] Function names cannot be demangled due to ".omp_fn" suffix
Summary: [gomp] Function names cannot be demangled due to ".omp_fn" suffix
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: unknown
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic, monitored, openmp
Depends on:
Blocks:
 
Reported: 2005-11-24 10:36 UTC by Volker Reichelt
Modified: 2013-12-16 01:04 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-09-03 21:39:39


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2005-11-24 10:36:00 UTC
Compiling the following code snippet with "g++ -fopenmp -O -Wall"
I get a hosed error message:

============================
int i;

void foo()
{
#pragma omp parallel
    {
        int j;
        i = j;
    }
}
============================

bug.cc: In function 'void _Z3foov.omp_fn.0(void*)':
bug.cc:8: warning: 'j' is used uninitialized in this function

Because of the ".omp_fn.0" at the end of the function name the demangler
cannot process it.

Jakub, this is because of your patch
http://gcc.gnu.org/ml/gcc-patches/2005-10/msg01644.html

Should we regard the ".omp_fn.0" suffix as an extension to the name
mangling scheme and teach the demangler how to handle those things?

This problem will probably also come up with debuggers etc.
Comment 1 Andrew Pinski 2005-11-25 20:31:54 UTC
actually there is no demangling in the C++ front-end.  What is usually is giving is just a friendly version of the string (there is a way to do this but I don't know how).

Now the demangler might need to be expanded to support this (but that is a different issue from the C++ front-end issue).
Comment 2 Richard Henderson 2005-11-25 22:38:09 UTC
No, this isn't a failure of the demangler.  Nor do ever expect these 
functions to ever be demangled.  That they contain the original function
name at all is merely an aid to us the compiler developer.

I don't see that this is any better or worse, from the user's perspective,
than just "__omp_fn.N", which is what we had before the patch.

Unless you can come up with some convincing user usage scenario, I'm not
going to address this problem at all.
Comment 3 Jakub Jelinek 2006-03-27 16:29:05 UTC
What we perhaps could do is hack up C++ lang_decl_name etc., so that for the
artificially created .omp_fn* functions the diagnostic machinery would instead print the name of the
original function, perhaps annotated with #pragma omp region of ...
or something similar.
Not sure if we can use for that just if (DECL_ARTIFICIAL (current_function_decl)
&& name starts with create_omp_child_function_name prefix)
or if we would need to add some special attribute or bit (and if the latter,
if it is worth doing).
Comment 4 Paolo Carlini 2011-09-27 08:49:04 UTC
Now it says "In function ‘<built-in>’". Jakub, could we do better here?
Comment 5 Dmitry Gorbachev 2013-12-16 01:04:36 UTC
Now, `_Z3foov._omp_fn.0' is demangled as `foo() [clone ._omp_fn.0]'. GCC could use that instead of just '<built-in>'.