public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/55570] New: Undefined variable in alignment compiler directive causes compiler segfault
@ 2012-12-03  2:51 david.wetterau at gmail dot com
  2012-12-03  8:58 ` [Bug c/55570] " mpolacek at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: david.wetterau at gmail dot com @ 2012-12-03  2:51 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55570

             Bug #: 55570
           Summary: Undefined variable in alignment compiler directive
                    causes compiler segfault
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: david.wetterau@gmail.com


Created attachment 28857
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28857
.i file that generates compiler segfault

Version:

$ gcc --version
gcc (GCC) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

System Type:

$ uname -a 
Linux david-pc 3.6.8-1-ARCH #1 SMP PREEMPT Mon Nov 26 22:10:40 CET 2012 x86_64
GNU/Linux

Compiler command:
gcc -c test.c -o test

Compiler output:
$ gcc -c test.c -o test
test.c:1:1: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.archlinux.org/> for instructions.

C code: 
char array[16] __attribute__((aligned (SOME_NOT_DEFINED_MACRO)));

int main() {
    return 0;
}

.i file attached.


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

* [Bug c/55570] Undefined variable in alignment compiler directive causes compiler segfault
  2012-12-03  2:51 [Bug c/55570] New: Undefined variable in alignment compiler directive causes compiler segfault david.wetterau at gmail dot com
@ 2012-12-03  8:58 ` mpolacek at gcc dot gnu.org
  2012-12-03  9:05 ` [Bug c/55570] [4.7/4.8 regression] " mpolacek at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2012-12-03  8:58 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55570

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-12-03
                 CC|                            |mpolacek at gcc dot gnu.org
     Ever Confirmed|0                           |1

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> 2012-12-03 08:57:59 UTC ---
Confirmed.  Reproduced with trunk:
pr55570.c:1:1: internal compiler error: Segmentation fault
 char array[16] __attribute__((aligned (SOME_NOT_DEFINED_MACRO)));
 ^
0x8dc29f crash_signal
    /home/marek/src/gcc/gcc/toplev.c:334
0x54aa54 check_user_alignment(tree_node const*, bool)
    /home/marek/src/gcc/gcc/c-family/c-common.c:7264
0x56bb8b handle_aligned_attribute
    /home/marek/src/gcc/gcc/c-family/c-common.c:7391
0x4de269 decl_attributes(tree_node**, tree_node*, int)
    /home/marek/src/gcc/gcc/attribs.c:547
0x4f6d58 start_decl(c_declarator*, c_declspecs*, bool, tree_node*)
    /home/marek/src/gcc/gcc/c/c-decl.c:4113
0x532954 c_parser_declaration_or_fndef
    /home/marek/src/gcc/gcc/c/c-parser.c:1664
0x53716d c_parser_external_declaration
    /home/marek/src/gcc/gcc/c/c-parser.c:1363
0x537b97 c_parser_translation_unit
    /home/marek/src/gcc/gcc/c/c-parser.c:1251
0x537b97 c_parse_file()
    /home/marek/src/gcc/gcc/c/c-parser.c:10889
0x57c0f4 c_common_parse_file()
    /home/marek/src/gcc/gcc/c-family/c-opts.c:1023
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

With 4.6 we did:
pr55570.c:1:1: error: requested alignment is not a constant
which was better than just segfaulting.


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

* [Bug c/55570] [4.7/4.8 regression] Undefined variable in alignment compiler directive causes compiler segfault
  2012-12-03  2:51 [Bug c/55570] New: Undefined variable in alignment compiler directive causes compiler segfault david.wetterau at gmail dot com
  2012-12-03  8:58 ` [Bug c/55570] " mpolacek at gcc dot gnu.org
@ 2012-12-03  9:05 ` mpolacek at gcc dot gnu.org
  2012-12-03 10:07 ` mpolacek at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2012-12-03  9:05 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55570

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.8.0
            Summary|Undefined variable in       |[4.7/4.8 regression]
                   |alignment compiler          |Undefined variable in
                   |directive causes compiler   |alignment compiler
                   |segfault                    |directive causes compiler
                   |                            |segfault


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

* [Bug c/55570] [4.7/4.8 regression] Undefined variable in alignment compiler directive causes compiler segfault
  2012-12-03  2:51 [Bug c/55570] New: Undefined variable in alignment compiler directive causes compiler segfault david.wetterau at gmail dot com
  2012-12-03  8:58 ` [Bug c/55570] " mpolacek at gcc dot gnu.org
  2012-12-03  9:05 ` [Bug c/55570] [4.7/4.8 regression] " mpolacek at gcc dot gnu.org
@ 2012-12-03 10:07 ` mpolacek at gcc dot gnu.org
  2012-12-03 10:34 ` mpolacek at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2012-12-03 10:07 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55570

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> 2012-12-03 10:07:22 UTC ---
That's because in 4.8/4.7 we introduced
c-family/c-common.c:check_user_alignment which contains:
  if (!INTEGRAL_TYPE_P (TREE_TYPE (align))
      || TREE_CODE (align) != INTEGER_CST)
    {
      error ("requested alignment is not an integer constant");
      return -1;
    }
but when we get undefined macro as a parameter, the TREE_CODE of align is
IDENTIFIER_NODE: 
(gdb) call debug_tree (align)
 <identifier_node 0x7ffff1aa9690 SOME_NOT_DEFINED_MACRO>
but we don't check for that.


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

* [Bug c/55570] [4.7/4.8 regression] Undefined variable in alignment compiler directive causes compiler segfault
  2012-12-03  2:51 [Bug c/55570] New: Undefined variable in alignment compiler directive causes compiler segfault david.wetterau at gmail dot com
                   ` (2 preceding siblings ...)
  2012-12-03 10:07 ` mpolacek at gcc dot gnu.org
@ 2012-12-03 10:34 ` mpolacek at gcc dot gnu.org
  2012-12-03 10:39 ` mpolacek at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2012-12-03 10:34 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55570

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> 2012-12-03 10:33:58 UTC ---
In fact, we of course check for that, we should just switch the expressions in
the if.  Testing a fix.


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

* [Bug c/55570] [4.7/4.8 regression] Undefined variable in alignment compiler directive causes compiler segfault
  2012-12-03  2:51 [Bug c/55570] New: Undefined variable in alignment compiler directive causes compiler segfault david.wetterau at gmail dot com
                   ` (3 preceding siblings ...)
  2012-12-03 10:34 ` mpolacek at gcc dot gnu.org
@ 2012-12-03 10:39 ` mpolacek at gcc dot gnu.org
  2012-12-03 11:38 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2012-12-03 10:39 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55570

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |mpolacek at gcc dot gnu.org
                   |gnu.org                     |


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

* [Bug c/55570] [4.7/4.8 regression] Undefined variable in alignment compiler directive causes compiler segfault
  2012-12-03  2:51 [Bug c/55570] New: Undefined variable in alignment compiler directive causes compiler segfault david.wetterau at gmail dot com
                   ` (4 preceding siblings ...)
  2012-12-03 10:39 ` mpolacek at gcc dot gnu.org
@ 2012-12-03 11:38 ` rguenth at gcc dot gnu.org
  2012-12-03 12:08 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-12-03 11:38 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55570

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.8.0                       |4.7.3


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

* [Bug c/55570] [4.7/4.8 regression] Undefined variable in alignment compiler directive causes compiler segfault
  2012-12-03  2:51 [Bug c/55570] New: Undefined variable in alignment compiler directive causes compiler segfault david.wetterau at gmail dot com
                   ` (5 preceding siblings ...)
  2012-12-03 11:38 ` rguenth at gcc dot gnu.org
@ 2012-12-03 12:08 ` jakub at gcc dot gnu.org
  2012-12-03 13:02 ` mpolacek at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-12-03 12:08 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55570

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

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-12-03 12:07:59 UTC ---
Yeah, first check for != INTEGER_CST, only if it is INTEGER_CST check for
TREE_TYPE.
Caused by http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181048


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

* [Bug c/55570] [4.7/4.8 regression] Undefined variable in alignment compiler directive causes compiler segfault
  2012-12-03  2:51 [Bug c/55570] New: Undefined variable in alignment compiler directive causes compiler segfault david.wetterau at gmail dot com
                   ` (6 preceding siblings ...)
  2012-12-03 12:08 ` jakub at gcc dot gnu.org
@ 2012-12-03 13:02 ` mpolacek at gcc dot gnu.org
  2012-12-03 13:11 ` mpolacek at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2012-12-03 13:02 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55570

--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> 2012-12-03 13:02:10 UTC ---
Author: mpolacek
Date: Mon Dec  3 13:02:04 2012
New Revision: 194083

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194083
Log:
Fix PR c/55570.

Added:
    trunk/gcc/testsuite/gcc.dg/pr55570.c
Modified:
    trunk/gcc/c-family/ChangeLog
    trunk/gcc/c-family/c-common.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c/55570] [4.7/4.8 regression] Undefined variable in alignment compiler directive causes compiler segfault
  2012-12-03  2:51 [Bug c/55570] New: Undefined variable in alignment compiler directive causes compiler segfault david.wetterau at gmail dot com
                   ` (8 preceding siblings ...)
  2012-12-03 13:11 ` mpolacek at gcc dot gnu.org
@ 2012-12-03 13:11 ` mpolacek at gcc dot gnu.org
  2013-10-01  0:03 ` pinskia at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2012-12-03 13:11 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55570

--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> 2012-12-03 13:10:33 UTC ---
Author: mpolacek
Date: Mon Dec  3 13:10:18 2012
New Revision: 194084

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194084
Log:
Fix PR c/55570.

Added:
    branches/gcc-4_7-branch/gcc/testsuite/gcc.dg/pr55570.c
Modified:
    branches/gcc-4_7-branch/gcc/c-family/ChangeLog
    branches/gcc-4_7-branch/gcc/c-family/c-common.c
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog


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

* [Bug c/55570] [4.7/4.8 regression] Undefined variable in alignment compiler directive causes compiler segfault
  2012-12-03  2:51 [Bug c/55570] New: Undefined variable in alignment compiler directive causes compiler segfault david.wetterau at gmail dot com
                   ` (7 preceding siblings ...)
  2012-12-03 13:02 ` mpolacek at gcc dot gnu.org
@ 2012-12-03 13:11 ` mpolacek at gcc dot gnu.org
  2012-12-03 13:11 ` mpolacek at gcc dot gnu.org
  2013-10-01  0:03 ` pinskia at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2012-12-03 13:11 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55570

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

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

--- Comment #7 from Marek Polacek <mpolacek at gcc dot gnu.org> 2012-12-03 13:11:13 UTC ---
Fixed.


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

* [Bug c/55570] [4.7/4.8 regression] Undefined variable in alignment compiler directive causes compiler segfault
  2012-12-03  2:51 [Bug c/55570] New: Undefined variable in alignment compiler directive causes compiler segfault david.wetterau at gmail dot com
                   ` (9 preceding siblings ...)
  2012-12-03 13:11 ` mpolacek at gcc dot gnu.org
@ 2013-10-01  0:03 ` pinskia at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-10-01  0:03 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55570

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dbruening at acm dot org

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 58588 has been marked as a duplicate of this bug. ***


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

end of thread, other threads:[~2013-10-01  0:03 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-03  2:51 [Bug c/55570] New: Undefined variable in alignment compiler directive causes compiler segfault david.wetterau at gmail dot com
2012-12-03  8:58 ` [Bug c/55570] " mpolacek at gcc dot gnu.org
2012-12-03  9:05 ` [Bug c/55570] [4.7/4.8 regression] " mpolacek at gcc dot gnu.org
2012-12-03 10:07 ` mpolacek at gcc dot gnu.org
2012-12-03 10:34 ` mpolacek at gcc dot gnu.org
2012-12-03 10:39 ` mpolacek at gcc dot gnu.org
2012-12-03 11:38 ` rguenth at gcc dot gnu.org
2012-12-03 12:08 ` jakub at gcc dot gnu.org
2012-12-03 13:02 ` mpolacek at gcc dot gnu.org
2012-12-03 13:11 ` mpolacek at gcc dot gnu.org
2012-12-03 13:11 ` mpolacek at gcc dot gnu.org
2013-10-01  0:03 ` pinskia 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).