public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/61977] New: powerpc-eabi preprocessor breaks on lines that end with "vector"
@ 2014-07-31 15:32 drivshin at allworx dot com
  2015-03-20 19:18 ` [Bug target/61977] " drivshin at allworx dot com
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: drivshin at allworx dot com @ 2014-07-31 15:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61977

            Bug ID: 61977
           Summary: powerpc-eabi preprocessor breaks on lines that end
                    with "vector"
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: drivshin at allworx dot com

Created attachment 33219
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33219&action=edit
patch to revert 210055 and 211656

The powerpc-eabi (and powerpc-eabispe -mno-spe; I haven't tried other
powerpc-*) preprocessor misbehaves when a line ends with "vector". I happened
to hit this in assembler comments, but that does not appear to be a
requirement.

Examples of lines which cause the failure:
vector
# vector
# x vector
x # vector
; vector
# .vector
# +vector

Examples of lines which do not cause the failure:
# vectors
# vector x
# vector.
# _vector
// vector   (unless -C is given)
vector;

The symptom depends on whether that is the last non-whitespace line in the
file. If it is, then the result is an ICE. If it is not, then just "vector"
appears by itself on the next line.

This did not happen on GCC 4.9.0, but does happen in GCC 4.9.1 and the current
trunk. Bisecting between 4.9.0 and 4.9.1 points to SVN revision 210055 as
introducing this behavior. Reverting r210055 (and also r211656 which seemed to
be dependant upon r210055) appears to fix the issue, and a patch (against
4.9.1) doing that is attached.

----

$ prefix/bin/powerpc-eabi-gcc -v
Using built-in specs.
COLLECT_GCC=prefix/bin/powerpc-eabi-gcc
COLLECT_LTO_WRAPPER=/home/drivshin/gcc-powerpc-eabi/prefix/bin/../libexec/gcc/powerpc-eabi/4.9.1/lto-wrapper
Target: powerpc-eabi
Configured with: ../gcc-4.9.1/configure -v
--prefix=/home/drivshin/gcc-powerpc-eabi/build-gcc/../prefix
--target=powerpc-eabi --enable-languages=c
Thread model: single
gcc version 4.9.1 (GCC) 

---- 

$ echo -e "# comment ending in vector\n# another comment" |
prefix/bin/powerpc-eabi-cpp -x assembler-with-cpp
# 1 "<stdin>"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "<stdin>"
# comment ending in
 vector
# 2 "<stdin>"
# another comment

----

$ echo -e "# comment ending in vector" | prefix/bin/powerpc-eabi-cpp -x
assembler-with-cpp
# 1 "<stdin>"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "<stdin>"
<stdin>:1:0: internal compiler error: Segmentation fault
0x82f7bf crash_signal
        ../../gcc-4.9.1/gcc/toplev.c:337
0xc37b75 _cpp_lex_direct
        ../../gcc-4.9.1/libcpp/lex.c:2171
0xc389fb _cpp_lex_token
        ../../gcc-4.9.1/libcpp/lex.c:2055
0xc3d117 cpp_get_token_1
        ../../gcc-4.9.1/libcpp/macro.c:2359
0x559877 scan_translation_unit
        ../../gcc-4.9.1/gcc/c-family/c-ppoutput.c:176
0x559877 preprocess_file(cpp_reader*)
        ../../gcc-4.9.1/gcc/c-family/c-ppoutput.c:101
0x558360 c_common_init()
        ../../gcc-4.9.1/gcc/c-family/c-opts.c:1047
0x4ff08d c_objc_common_init()
        ../../gcc-4.9.1/gcc/c/c-objc-common.c:65
0x8312c6 lang_dependent_init
        ../../gcc-4.9.1/gcc/toplev.c:1712
0x8312c6 do_compile
        ../../gcc-4.9.1/gcc/toplev.c:1900


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/61977] powerpc-eabi preprocessor breaks on lines that end with "vector"
  2014-07-31 15:32 [Bug target/61977] New: powerpc-eabi preprocessor breaks on lines that end with "vector" drivshin at allworx dot com
@ 2015-03-20 19:18 ` drivshin at allworx dot com
  2015-03-31 17:11 ` [Bug target/61977] powerpc " msebor at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: drivshin at allworx dot com @ 2015-03-20 19:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61977

David Rivshin <drivshin at allworx dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |powerpc-eabi
      Known to work|                            |4.9.0
      Known to fail|                            |4.9.1, 4.9.2

--- Comment #1 from David Rivshin <drivshin at allworx dot com> ---
This is still happening in the latest trunk and latest 4.9 branch code.

Simplified steps to reproduce:
../gcc.svn/configure --prefix=${PWD}/../local --enable-languages=c
--with-gnu-as --with-gnu-ld --disable-libstdcxx-pch --target=powerpc-eabi
--disable-shared --with-newlib
make all-gcc
make install-gcc
echo -e "# comment ending in vector" | ../local/bin/powerpc-eabi-cpp -x
assembler-with-cpp


I'm fairly certain this is the same root cause as bug 51654, and changeset
r210055 just exposed some non-altivec powerpc targets to it. In addition to the
workarounds mentioned there (bug 51654, comment 3), removing the call to
init_vector_keywords() in rs6000_cpu_cpp_builtins() also works. 

Since those vector keywords only have effect if TARGET_ALTIVEC (see
rs6000_macro_to_expand()), making their definition conditional upon
TARGET_ALTIVEC resolves the 4.9.1 regression (as best I can tell). Although
that obviously does not resolve the underlying issue, which has existed since
at least 4.6 (according to bug 51654).


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/61977] powerpc preprocessor breaks on lines that end with "vector"
  2014-07-31 15:32 [Bug target/61977] New: powerpc-eabi preprocessor breaks on lines that end with "vector" drivshin at allworx dot com
  2015-03-20 19:18 ` [Bug target/61977] " drivshin at allworx dot com
@ 2015-03-31 17:11 ` msebor at gcc dot gnu.org
  2015-03-31 17:29 ` trippels at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: msebor at gcc dot gnu.org @ 2015-03-31 17:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61977

--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
See also pr65638 for a similar problem.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/61977] powerpc preprocessor breaks on lines that end with "vector"
  2014-07-31 15:32 [Bug target/61977] New: powerpc-eabi preprocessor breaks on lines that end with "vector" drivshin at allworx dot com
  2015-03-20 19:18 ` [Bug target/61977] " drivshin at allworx dot com
  2015-03-31 17:11 ` [Bug target/61977] powerpc " msebor at gcc dot gnu.org
@ 2015-03-31 17:29 ` trippels at gcc dot gnu.org
  2015-03-31 17:51 ` jakub at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: trippels at gcc dot gnu.org @ 2015-03-31 17:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61977

Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |JamesMikeDuPont@googlemail.
                   |                            |com

--- Comment #4 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
*** Bug 65638 has been marked as a duplicate of this bug. ***


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug target/61977] powerpc preprocessor breaks on lines that end with "vector"
  2014-07-31 15:32 [Bug target/61977] New: powerpc-eabi preprocessor breaks on lines that end with "vector" drivshin at allworx dot com
                   ` (2 preceding siblings ...)
  2015-03-31 17:29 ` trippels at gcc dot gnu.org
@ 2015-03-31 17:51 ` jakub at gcc dot gnu.org
  2015-03-31 18:07 ` [Bug preprocessor/61977] [4.8/4.9/5 Regression] " jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-03-31 17:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61977

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The problem is that cpp_peek_token, if it returns CPP_EOF, is fatal in the
preprocessing:
  do
    {
      peektok = _cpp_lex_token (pfile);
      if (peektok->type == CPP_EOF)
        return peektok;
    }
  while (index--);
but the macro_to_expand stuff (for which cpp_peek_token has been written, BTW)
really assumes that it can non-destructively peek tokens when needed.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug preprocessor/61977] [4.8/4.9/5 Regression] powerpc preprocessor breaks on lines that end with "vector"
  2014-07-31 15:32 [Bug target/61977] New: powerpc-eabi preprocessor breaks on lines that end with "vector" drivshin at allworx dot com
                   ` (3 preceding siblings ...)
  2015-03-31 17:51 ` jakub at gcc dot gnu.org
@ 2015-03-31 18:07 ` jakub at gcc dot gnu.org
  2015-03-31 18:26 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-03-31 18:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61977

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|target                      |preprocessor
   Target Milestone|---                         |4.8.5
            Summary|powerpc preprocessor breaks |[4.8/4.9/5 Regression]
                   |on lines that end with      |powerpc preprocessor breaks
                   |"vector"                    |on lines that end with
                   |                            |"vector"

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Obviously regression from the times when vector wasn't a conditional macro.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug preprocessor/61977] [4.8/4.9/5 Regression] powerpc preprocessor breaks on lines that end with "vector"
  2014-07-31 15:32 [Bug target/61977] New: powerpc-eabi preprocessor breaks on lines that end with "vector" drivshin at allworx dot com
                   ` (4 preceding siblings ...)
  2015-03-31 18:07 ` [Bug preprocessor/61977] [4.8/4.9/5 Regression] " jakub at gcc dot gnu.org
@ 2015-03-31 18:26 ` jakub at gcc dot gnu.org
  2015-04-01 14:57 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-03-31 18:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61977

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2015-03-31
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 35194
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35194&action=edit
gcc5-pr61977.patch

Untested fix.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug preprocessor/61977] [4.8/4.9/5 Regression] powerpc preprocessor breaks on lines that end with "vector"
  2014-07-31 15:32 [Bug target/61977] New: powerpc-eabi preprocessor breaks on lines that end with "vector" drivshin at allworx dot com
                   ` (5 preceding siblings ...)
  2015-03-31 18:26 ` jakub at gcc dot gnu.org
@ 2015-04-01 14:57 ` jakub at gcc dot gnu.org
  2015-04-02 11:55 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-04-01 14:57 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61977

--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Please see:
http://gcc.gnu.org/ml/gcc-patches/2015-04/msg00004.html
http://gcc.gnu.org/ml/gcc-patches/2015-04/msg00005.html
http://gcc.gnu.org/ml/gcc-patches/2015-04/msg00013.html


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug preprocessor/61977] [4.8/4.9/5 Regression] powerpc preprocessor breaks on lines that end with "vector"
  2014-07-31 15:32 [Bug target/61977] New: powerpc-eabi preprocessor breaks on lines that end with "vector" drivshin at allworx dot com
                   ` (6 preceding siblings ...)
  2015-04-01 14:57 ` jakub at gcc dot gnu.org
@ 2015-04-02 11:55 ` jakub at gcc dot gnu.org
  2015-04-02 12:08 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-04-02 11:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61977

--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Thu Apr  2 11:54:58 2015
New Revision: 221838

URL: https://gcc.gnu.org/viewcvs?rev=221838&root=gcc&view=rev
Log:
    PR preprocessor/61977
    * config/rs6000/rs6000-c.c (rs6000_cpu_cpp_builtins): Don't
    predefine __vector/__bool/__pixel macros nor context sensitive
    macros for CLK_ASM.
    * config/spu/spu-c.c (spu_cpu_cpp_builtins): Similarly.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/rs6000/rs6000-c.c
    trunk/gcc/config/spu/spu-c.c


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug preprocessor/61977] [4.8/4.9/5 Regression] powerpc preprocessor breaks on lines that end with "vector"
  2014-07-31 15:32 [Bug target/61977] New: powerpc-eabi preprocessor breaks on lines that end with "vector" drivshin at allworx dot com
                   ` (7 preceding siblings ...)
  2015-04-02 11:55 ` jakub at gcc dot gnu.org
@ 2015-04-02 12:08 ` jakub at gcc dot gnu.org
  2015-04-06 17:02 ` jakub at gcc dot gnu.org
  2015-04-06 17:04 ` jakub at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-04-02 12:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61977

--- Comment #13 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Two out of the 3 patches applied to trunk, still waiting for review of the
first patch.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug preprocessor/61977] [4.8/4.9/5 Regression] powerpc preprocessor breaks on lines that end with "vector"
  2014-07-31 15:32 [Bug target/61977] New: powerpc-eabi preprocessor breaks on lines that end with "vector" drivshin at allworx dot com
                   ` (8 preceding siblings ...)
  2015-04-02 12:08 ` jakub at gcc dot gnu.org
@ 2015-04-06 17:02 ` jakub at gcc dot gnu.org
  2015-04-06 17:04 ` jakub at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-04-06 17:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61977

--- Comment #14 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Mon Apr  6 17:01:50 2015
New Revision: 221882

URL: https://gcc.gnu.org/viewcvs?rev=221882&root=gcc&view=rev
Log:
    PR preprocessor/61977
    * lex.c (cpp_peek_token): If peektok is CPP_EOF, back it up
    with all tokens peeked by the current function.

    * gcc.dg/cpp/pr61977.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/cpp/pr61977.c
Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/libcpp/ChangeLog
    trunk/libcpp/lex.c


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug preprocessor/61977] [4.8/4.9/5 Regression] powerpc preprocessor breaks on lines that end with "vector"
  2014-07-31 15:32 [Bug target/61977] New: powerpc-eabi preprocessor breaks on lines that end with "vector" drivshin at allworx dot com
                   ` (9 preceding siblings ...)
  2015-04-06 17:02 ` jakub at gcc dot gnu.org
@ 2015-04-06 17:04 ` jakub at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-04-06 17:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61977

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #15 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-04-06 17:04 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-31 15:32 [Bug target/61977] New: powerpc-eabi preprocessor breaks on lines that end with "vector" drivshin at allworx dot com
2015-03-20 19:18 ` [Bug target/61977] " drivshin at allworx dot com
2015-03-31 17:11 ` [Bug target/61977] powerpc " msebor at gcc dot gnu.org
2015-03-31 17:29 ` trippels at gcc dot gnu.org
2015-03-31 17:51 ` jakub at gcc dot gnu.org
2015-03-31 18:07 ` [Bug preprocessor/61977] [4.8/4.9/5 Regression] " jakub at gcc dot gnu.org
2015-03-31 18:26 ` jakub at gcc dot gnu.org
2015-04-01 14:57 ` jakub at gcc dot gnu.org
2015-04-02 11:55 ` jakub at gcc dot gnu.org
2015-04-02 12:08 ` jakub at gcc dot gnu.org
2015-04-06 17:02 ` jakub at gcc dot gnu.org
2015-04-06 17:04 ` jakub at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).