Jakub Jelinek 4ec9d09623 dwarf2out: Fix up add_scalar_info not to create invalid DWARF
As discussed in https://sourceware.org/bugzilla/show_bug.cgi?id=26987 ,
for very large bounds (which don't fit into HOST_WIDE_INT) GCC emits invalid
DWARF.
In DWARF2, DW_AT_{lower,upper}_bound were constant reference class.
In DWARF3 they are block constant reference and the
Static and Dynamic Properties of Types
chapter says:
"For a block, the value is interpreted as a DWARF expression; evaluation of the expression
yields the value of the attribute."
In DWARF4/5 they are constant exprloc reference class.
Now, for add_AT_wide we use DW_FORM_data16 (valid in constant class)
when -gdwarf-5, but otherwise just use DW_FORM_block1, which is not constant
class, but block.
For DWARF3 this means emitting clearly invalid DWARF, because the
DW_FORM_block1 should contain a DWARF expression, not random bytes
containing the constant directly.
For DWARF2/DWARF4/5 it could be considered a GNU extension, but a very badly
designed one when it means something different in DWARF3.

The following patch uses add_AT_wide only if we know we'll be using
DW_FORM_data16, and otherwise wastes 2 extra bytes and emits in there
DW_OP_implicit_value <size> before the constant.

2020-12-03  Jakub Jelinek  <jakub@redhat.com>

	* dwarf2out.c (add_scalar_info): Only use add_AT_wide for 128-bit
	constants and only in dwarf-5 or later, where DW_FORM_data16 is
	available.  Otherwise use DW_FORM_block*/DW_FORM_exprloc with
	DW_OP_implicit_value to describe the constant.
2020-12-03 00:41:47 +01:00
2020-11-26 00:16:41 +00:00
2020-11-30 00:16:27 +00:00
2020-11-30 00:16:27 +00:00
2020-12-02 00:16:41 +00:00
2020-11-30 00:16:27 +00:00
2020-12-01 00:16:38 +00:00
2020-11-30 00:16:27 +00:00
2020-11-30 00:16:27 +00:00
2020-11-30 00:16:27 +00:00
2020-11-26 00:16:41 +00:00
2020-11-30 00:16:27 +00:00
2020-11-30 00:16:27 +00:00
2020-11-30 00:16:27 +00:00
2020-12-01 00:16:38 +00:00
2020-11-30 00:16:27 +00:00
2020-11-30 00:16:27 +00:00
2020-11-30 00:16:27 +00:00
2020-11-30 00:16:27 +00:00
2020-11-30 00:16:27 +00:00
2020-11-30 00:16:27 +00:00
2020-12-02 11:04:01 -07:00
2020-11-30 00:16:27 +00:00

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.
Description
No description provided
Readme 2.1 GiB
Languages
C++ 31.9%
C 31.3%
Ada 12%
D 6.5%
Go 6.4%
Other 11.5%