Bug 36904 - [4.4 Regression] vector context sensitive keyword vs macros
Summary: [4.4 Regression] vector context sensitive keyword vs macros
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.4.0
: P1 normal
Target Milestone: 4.4.0
Assignee: Jakub Jelinek
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2008-07-23 01:34 UTC by Andrew Pinski
Modified: 2008-09-10 21:10 UTC (History)
2 users (show)

See Also:
Host:
Target: powerpc-linux
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
gcc44-pr36904.patch (893 bytes, patch)
2008-08-01 12:45 UTC, Jakub Jelinek
Details | Diff
gcc44-pr36904.patch (1.10 KB, patch)
2008-09-01 15:38 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Pinski 2008-07-23 01:34:19 UTC
Take the following testcase:
#include <altivec.h>
#define xprint_vec(type)  void x##type(vector type v) { }
xprint_vec(float);

This used to work in 4.3 and before but does not currently.  The problem here was introduced when the context sensitive keyword support was added.
Comment 1 Jakub Jelinek 2008-08-01 12:45:17 UTC
Created attachment 15990 [details]
gcc44-pr36904.patch

Partial fix, which fixes the testcase from this PR, but still other cases
in the made up testcase fail and I don't know if they are meant to work or not.
Comment 2 bje@au1.ibm.com 2008-08-26 12:29:33 UTC
Subject: Re:  [4.4 Regression] vector context sensitive
	keyword vs macros

> Partial fix, which fixes the testcase from this PR, but still other cases
> in the made up testcase fail and I don't know if they are meant to
> work or not.

If it does not make things worse, should we apply this patch?

Ben


Comment 3 Jakub Jelinek 2008-09-01 15:38:31 UTC
Created attachment 16179 [details]
gcc44-pr36904.patch

Updated patch, apparently all other problems can be fixed just by never expanding the conditional keywords to self.  This will make preprocessing them
tiny bit slower (as the macro_to_expand hook might be called several times on it), but means we handle right even the cases where cpp_get_token is called with
a conditional macro token in some inner context where following tokens aren't seen yet (e.g. macro args, etc.).

I don't have any altivec.h codebase around, could one of you test this on something larger?  Thanks.
Comment 4 Jakub Jelinek 2008-09-10 21:07:48 UTC
Subject: Bug 36904

Author: jakub
Date: Wed Sep 10 21:06:25 2008
New Revision: 140247

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=140247
Log:
	PR target/36904
	* config/rs6000/rs6000-c.c (rs6000_macro_to_expand): Return NULL
	instead of tok->val.node if not expanding to something else.  Handle
	intervening CPP_PADDING tokens.
	(altivec_categorize_keyword): Remove unneeded comparisons.

	* gcc.target/powerpc/altivec-27.c: New test.

Added:
    trunk/gcc/testsuite/gcc.target/powerpc/altivec-27.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/rs6000/rs6000-c.c
    trunk/gcc/testsuite/ChangeLog

Comment 5 Jakub Jelinek 2008-09-10 21:10:15 UTC
Fixed.