Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 445606 (PR48226) - sys-devel/gcc-4.5.x: Preprocessor munges the word "vector" when -maltivec is in effect
Summary: sys-devel/gcc-4.5.x: Preprocessor munges the word "vector" when -maltivec is ...
Status: RESOLVED FIXED
Alias: PR48226
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: PPC Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL: http://gcc.gnu.org/PR48226
Whiteboard:
Keywords:
Depends on:
Blocks: 441836
  Show dependency tree
 
Reported: 2012-12-02 13:28 UTC by Marcus Comstedt
Modified: 2015-04-22 18:43 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcus Comstedt 2012-12-02 13:28:00 UTC
When preprocessing the following snippet:

namespace a {
  typedef int vector[3];
};
typedef a::vector vector;

using g++ -maltivec -E foo.cpp, then the output is

# 1 "foo.cpp"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "foo.cpp"
namespace a {
  typedef int vector[3];
};
typedef a::vector;

Notice how the final "vector" has disappeared.  It seems that gcc is providing a magical #define for "vector" which is not working correctly.  Using -dD, I can see

#define vector vector

but if I actually add this definition (or #undef vector) to the top of the file, then the output becomes correct.

g++ (Gentoo 4.5.4 p1.0, pie-0.4.7) 4.5.4


Reproducible: Always

Steps to Reproduce:
1. Type the above example into a file
2. Preprocess it with g++ -maltivec -E
3. Observe the result
Actual Results:  
typedef a::vector;


Expected Results:  
typedef a::vector vector;
Comment 1 Marcus Comstedt 2012-12-02 15:03:44 UTC
Another way of getting the correct output is this:

namespace a {
  typedef int vector[3];
};
#define DUMMY
typedef a::vector DUMMY vector;
Comment 2 SpanKY gentoo-dev 2012-12-02 20:27:27 UTC
not a bug.  "vector" is a gcc builtin type.
Comment 3 Marcus Comstedt 2012-12-02 20:29:40 UTC
So you are saying that it is correct that

namespace a {
  typedef int vector[3];
};
typedef a::vector vector;

and

namespace a {
  typedef int vector[3];
};
#define DUMMY
typedef a::vector DUMMY vector;

yield different results?  And since when is the preprocessor concerned with types?
Comment 4 SpanKY gentoo-dev 2012-12-02 20:40:29 UTC
feel free to file a bug at gcc.gnu.org and cc toolchain@g.o.  i've dealt with enough people getting yelling at "vector" and "__vector" to waste time on more.
Comment 5 Marcus Comstedt 2012-12-02 21:25:21 UTC
Actually the problem seems to have been reported (and fixed, so much for "not a bug" :) upstreams already:  http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48226

So either the fix could be backported to 4.5.4, or 4.7.2 (which has the fix) unmasked for ppc(64).
Comment 6 Marcus Comstedt 2012-12-03 15:52:08 UTC
For the record:  The patch from the gcc bugzilla applies cleanly to gcc-4.5.4 (I put it in my /etc/portage/patches), and the resulting gcc does not exhibit the problem.
Comment 7 SpanKY gentoo-dev 2012-12-03 21:24:21 UTC
(In reply to comment #5)

we don't really do arch-specific toolchain unmasking anymore.  especially not gcc-4.7 right now.

if there's a patch available, it's easy enough to add to the 4.5.x patchset.
Comment 8 SpanKY gentoo-dev 2012-12-21 05:19:40 UTC
queued up in all 4.5.x and 4.6.x patch series, and pushed out in current 4.5.4 and 4.6.3 ebuilds
Comment 9 Marcus Comstedt 2012-12-21 10:37:12 UTC
Thanks!

I confirm the issue as being resolved by the latest ebuild.

Happy holidays!