Bug 28474 - mangle_name.c mangles names unecessarily
Summary: mangle_name.c mangles names unecessarily
Alias: None
Product: gcc
Classification: Unclassified
Component: java (show other bugs)
Version: 4.2.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2006-07-24 21:04 UTC by Joel Dice
Modified: 2016-09-30 22:51 UTC (History)
4 users (show)

See Also:
Host: x86_64-unknown-linux-gnu
Target: x86_64-unknown-linux-gnu
Build: x86_64-unknown-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:

patch to reset uuU variable when a non-underscore is encountered (362 bytes, patch)
2006-07-24 21:07 UTC, Joel Dice
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joel Dice 2006-07-24 21:04:45 UTC
There is a bug in mangle_name.c which leads to mangling any name containing two underscores followed by a capital "U", even if those three characters are not consecutive.  For example, the following program will not link:

[begin Test.java]
public class Test {
  public static final native void x_y_NewUser();
  public static final native void xy__User();

  public static void main(String[] args) {
[end Test.java]

[begin natTest.cpp]
#include "Test.h"

void Test::x_y_NewUser() {

void Test::xy__User() {
[end natTest.cpp]

I will attach a patch which fixes the first case but not the second (since I'm not sure how the second case was intended to be handled).
Comment 1 Joel Dice 2006-07-24 21:07:11 UTC
Created attachment 11931 [details]
patch to reset uuU variable when a non-underscore is encountered
Comment 2 Mark Hesselink 2008-08-22 01:01:36 UTC
Over the past month I have been trying to make a largish Java project accessible from Perl using SWIG and GCJ. I have been very pleased with the way GCJ allowed me to accomplish this. Unfortunately, late in the project I was hit by this bug; several of the enumerations used in the Java code contained uppercase U's which were converted to _U (underscore followed by uppercase U). This eventually resulted in linking errors.

The patch attached to this bug solved the issue on GCC 4.3.1. I would therefore like to add my vote for this patch to be submitted to what is going to be GCC 4.4.
Comment 3 Andrew Haley 2009-10-20 16:01:48 UTC
Subject: Bug 28474

Author: aph
Date: Tue Oct 20 16:01:21 2009
New Revision: 153021

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=153021
2009-10-20  Joel Dice <dicej@mailsnare.net>

        PR java/28474
        * mangle_name.c (append_unicode_mangled_name): Fix mangling
        of names with multiple underscores and "U".
        (unicode_mangling_length): Likewise.


Comment 4 Andrew Pinski 2016-09-30 22:51:00 UTC
Closing as won't fix as the Java front-end has been removed from the trunk.