[Bug c/89812] [9 Regression] incorrect maximum in error: requested alignment ‘536870912’ exceeds maximum 2147483648

2019-03-28 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89812

--- Comment #7 from Jakub Jelinek  ---
Author: jakub
Date: Thu Mar 28 17:14:05 2019
New Revision: 270001

URL: https://gcc.gnu.org/viewcvs?rev=270001=gcc=rev
Log:
PR c/89812
* gcc.dg/attr-aligned-3.c: Limit the test to known ELF targets
other than AVR.  Add dg-options "".

Modified:
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.dg/attr-aligned-3.c

[Bug c/89812] [9 Regression] incorrect maximum in error: requested alignment ‘536870912’ exceeds maximum 2147483648

2019-03-26 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89812

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #6 from Jakub Jelinek  ---
The test is broken in multiple ways.  The long long diagnostics can be fixed
e.g. through adding { dg-options "" }, but there is more serious problem that
the test hardcodes the 1 << 28 MAX_OFILE_ALIGNMENT, which is only one of many
possible values:
defaults.h:#ifndef MAX_OFILE_ALIGNMENT
defaults.h:#define MAX_OFILE_ALIGNMENT BIGGEST_ALIGNMENT
config/alpha/vms.h:#define MAX_OFILE_ALIGNMENT 524288  /* 8 x 2^16 by DEC Ada
Test CD40VRA */
config/microblaze/microblaze.h:#define MAX_OFILE_ALIGNMENT 
(32768*8)
config/avr/elf.h:#define MAX_OFILE_ALIGNMENT (32768 * 8)
config/i386/xm-djgpp.h:#define MAX_OFILE_ALIGNMENT 128
config/i386/cygming.h:#define MAX_OFILE_ALIGNMENT (8192 * 8)
config/ia64/vms.h:#define MAX_OFILE_ALIGNMENT 524288  /* 8 x 2^16 by DEC Ada
Test CD40VRA */
config/pa/elf.h:#define MAX_OFILE_ALIGNMENT (32768 * 8)
config/pa/som.h:#define MAX_OFILE_ALIGNMENT 32768
config/pa/pa64-hpux.h:#define MAX_OFILE_ALIGNMENT 32768
config/darwin.h:#define MAX_OFILE_ALIGNMENT (0x8000 * 8)
config/nvptx/nvptx.h:#define MAX_OFILE_ALIGNMENT (32768 * 8)
config/mmix/mmix.h:#define MAX_OFILE_ALIGNMENT (32768 * 8)
config/elfos.h:#define MAX_OFILE_ALIGNMENT (((unsigned int) 1 << 28) * 8)
config/rs6000/xcoff.h:#define MAX_OFILE_ALIGNMENT 32768

We don't have an ELF effective target but I think even all ELF targets don't
actually use the 1 << 28 even when ignoring the above clearly visible AVR case
- any ELF target that doesn't use elfos.h and rolls stuff on its own and not
listed above will use BIGGEST_ALIGNMENT, which is most likely not 1 << 28.

So, I think we just need to limit the test to a couple of most common targets
with 1 << 28 max ofile alignment.

[Bug c/89812] [9 Regression] incorrect maximum in error: requested alignment ‘536870912’ exceeds maximum 2147483648

2019-03-26 Thread clyon at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89812

Christophe Lyon  changed:

   What|Removed |Added

 CC||clyon at gcc dot gnu.org

--- Comment #5 from Christophe Lyon  ---
The new test fails on arm with these additional error message:
testsuite/gcc.dg/attr-aligned-3.c:6:47: error: ISO C90 does not support 'long
long' [-Wlong-long]

[Bug c/89812] [9 Regression] incorrect maximum in error: requested alignment ‘536870912’ exceeds maximum 2147483648

2019-03-25 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89812

Martin Sebor  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #4 from Martin Sebor  ---
Fixed in r269927.

[Bug c/89812] [9 Regression] incorrect maximum in error: requested alignment ‘536870912’ exceeds maximum 2147483648

2019-03-25 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89812

--- Comment #3 from Martin Sebor  ---
Author: msebor
Date: Mon Mar 25 22:56:40 2019
New Revision: 269927

URL: https://gcc.gnu.org/viewcvs?rev=269927=gcc=rev
Log:
PR c/89812 - incorrect maximum in error: requested alignment '536870912'
exceeds maximum 2147483648

gcc/c-family/ChangeLog:

PR c/89812
* c-common.c (check_user_alignment): Rename local.  Correct maximum
alignment in diagnostic.  Avoid assuming argument fits in SHWI,
convert it to UHWI when it fits.

gcc/testsuite/ChangeLog:

PR c/89812
* gcc.dg/attr-aligned-3.c: New test.

Added:
trunk/gcc/testsuite/gcc.dg/attr-aligned-3.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/c-family/c-common.c
trunk/gcc/testsuite/ChangeLog

[Bug c/89812] [9 Regression] incorrect maximum in error: requested alignment ‘536870912’ exceeds maximum 2147483648

2019-03-25 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89812

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |9.0

[Bug c/89812] [9 Regression] incorrect maximum in error: requested alignment ‘536870912’ exceeds maximum 2147483648

2019-03-24 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89812

Martin Sebor  changed:

   What|Removed |Added

   Keywords||patch

--- Comment #2 from Martin Sebor  ---
Patch: https://gcc.gnu.org/ml/gcc-patches/2019-03/msg01166.html

[Bug c/89812] [9 Regression] incorrect maximum in error: requested alignment ‘536870912’ exceeds maximum 2147483648

2019-03-24 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89812

Martin Sebor  changed:

   What|Removed |Added

   Keywords||ice-on-invalid-code
Summary|incorrect maximum in error: |[9 Regression] incorrect
   |requested alignment |maximum in error: requested
   |‘536870912’ exceeds maximum |alignment ‘536870912’
   |2147483648  |exceeds maximum 2147483648

--- Comment #1 from Martin Sebor  ---
Another bug in the same code:

$ cat x.c && gcc -S b.c
typedef __attribute__ ((aligned (1U << 29))) char X;
b.c:1:1: internal compiler error: in tree_to_shwi, at tree.c:7267
1 | __attribute__ ((aligned ((__UINT64_TYPE__)1 << 63))) char x;
  | ^
0x15ba28f tree_to_shwi(tree_node const*)
/src/gcc/git-svn/gcc/tree.c:7267
0x90f6ae check_user_alignment(tree_node const*, bool, bool)
/src/gcc/git-svn/gcc/c-family/c-common.c:5302
0x97ab42 common_handle_aligned_attribute
/src/gcc/git-svn/gcc/c-family/c-attribs.c:2024
0x97b4e4 handle_aligned_attribute
/src/gcc/git-svn/gcc/c-family/c-attribs.c:2183
0x7f2bc1 decl_attributes(tree_node**, tree_node*, int, tree_node*)
/src/gcc/git-svn/gcc/attribs.c:718
0x80da64 c_decl_attributes
/src/gcc/git-svn/gcc/c/c-decl.c:4817
0x80e006 start_decl(c_declarator*, c_declspecs*, bool, tree_node*)
/src/gcc/git-svn/gcc/c/c-decl.c:4956
0x8862ac c_parser_declaration_or_fndef
/src/gcc/git-svn/gcc/c/c-parser.c:2154
0x884f1a c_parser_external_declaration
/src/gcc/git-svn/gcc/c/c-parser.c:1653
0x884a1b c_parser_translation_unit
/src/gcc/git-svn/gcc/c/c-parser.c:1534
0x8beced c_parse_file()
/src/gcc/git-svn/gcc/c/c-parser.c:19854
0x94ea72 c_common_parse_file()
/src/gcc/git-svn/gcc/c-family/c-opts.c:1156
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.