Bjorn Pettersson
7157a84082
[DwarfExpression] Disallow some rewrites to avoid undefined behavior
...
Summary:
The value operand in DW_OP_plus_uconst/DW_OP_constu value can be
large (it uses uint64_t as representation internally in LLVM).
This means that in the uint64_t to int conversions, previously done
by DwarfExpression::addMachineRegExpression, could lose information.
Also, the negation done in "-Offset" was undefined behavior in case
Offset was exactly INT_MIN.
To avoid the above problems, we now avoid transformation like
[Reg, DW_OP_plus_uconst, Offset] --> [DW_OP_breg, Offset]
and
[Reg, DW_OP_constu, Offset, DW_OP_plus] --> [DW_OP_breg, Offset]
when Offset > INT_MAX.
And we avoid to transform
[Reg, DW_OP_constu, Offset, DW_OP_minus] --> [DW_OP_breg,-Offset]
when Offset > INT_MAX+1.
The patch also adjusts DwarfCompileUnit::constructVariableDIEImpl
to make sure that "DW_OP_constu, Offset, DW_OP_minus" is used
instead of "DW_OP_plus_uconst, Offset" when creating DIExpressions
with negative frame index offsets.
Notice that this might just be the tip of the iceberg. There
are lots of fishy handling related to these constants. I think both
DIExpression::appendOffset and DIExpression::extractIfOffset may
trigger undefined behavior for certain values.
Reviewers: sdesmalen, rnk, JDevlieghere
Reviewed By: JDevlieghere
Subscribers: jholewinski, aprantl, hiraditya, ychen, uabelho, llvm-commits
Tags: #debug-info, #llvm
Differential Revision: https://reviews.llvm.org/D67263
llvm-svn: 371304
2019-09-07 11:40:10 +00:00
..
2017-09-12 21:50:55 +00:00
2018-03-21 21:31:25 +00:00
2018-05-09 02:40:45 +00:00
2019-05-01 05:27:20 +00:00
2019-05-01 05:27:20 +00:00
2019-01-24 03:27:57 +00:00
2019-01-15 16:18:52 +00:00
2019-01-15 16:18:52 +00:00
2019-01-15 16:18:52 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2019-04-29 18:34:18 +00:00
2019-05-21 12:48:46 +00:00
2019-01-15 16:18:52 +00:00
2019-01-15 16:18:52 +00:00
2018-10-30 23:28:27 +00:00
2018-05-24 23:00:21 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2017-09-12 21:50:55 +00:00
2019-01-15 16:18:52 +00:00
2019-01-15 16:18:52 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-09-05 10:18:36 +00:00
2019-03-19 13:49:03 +00:00
2019-05-16 12:50:39 +00:00
2019-03-19 15:15:28 +00:00
2019-03-19 15:15:28 +00:00
2019-05-15 02:35:32 +00:00
2018-07-26 22:48:52 +00:00
2019-05-15 02:35:32 +00:00
2018-05-09 02:40:45 +00:00
2019-06-06 21:19:39 +00:00
2019-06-13 10:03:17 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2019-06-10 16:53:37 +00:00
2019-05-01 05:27:20 +00:00
2018-03-29 17:16:41 +00:00
2019-06-19 00:25:39 +00:00
2018-07-26 20:56:53 +00:00
2018-01-31 22:04:26 +00:00
2019-06-19 00:25:39 +00:00
2018-07-26 20:56:53 +00:00
2019-06-19 00:25:39 +00:00
2019-06-19 00:25:39 +00:00
2018-05-09 02:40:45 +00:00
2019-07-12 19:25:45 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2019-08-29 19:03:58 +00:00
2018-05-09 02:40:45 +00:00
2018-12-22 08:43:08 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-08-08 16:33:22 +00:00
2018-05-09 02:40:45 +00:00
2018-09-26 04:19:23 +00:00
2019-06-17 09:13:29 +00:00
2018-07-26 20:56:53 +00:00
2019-09-05 10:00:22 +00:00
2018-02-23 23:01:06 +00:00
2018-08-16 21:29:55 +00:00
2018-08-24 20:31:05 +00:00
2018-04-20 10:44:42 +00:00
2019-05-15 02:35:32 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2017-10-10 14:15:25 +00:00
2018-08-03 12:01:43 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2019-08-29 10:53:29 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2019-09-07 11:40:10 +00:00
2019-02-13 09:34:07 +00:00
2019-06-17 09:13:29 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2019-07-31 16:51:28 +00:00
2018-05-09 02:40:45 +00:00
2018-10-11 23:37:58 +00:00
2019-01-15 16:18:52 +00:00
2018-05-09 02:40:45 +00:00
2018-05-10 10:51:33 +00:00
2019-09-04 10:09:12 +00:00
2019-09-04 11:47:20 +00:00
2018-01-16 11:17:57 +00:00
2019-09-04 10:09:12 +00:00
2019-08-29 14:26:05 +00:00
2019-02-01 17:11:58 +00:00
2018-03-29 13:47:57 +00:00
2019-07-02 14:47:49 +00:00
2018-11-07 21:39:09 +00:00
2018-02-23 23:01:06 +00:00
2018-04-20 15:29:47 +00:00
2018-02-23 23:01:06 +00:00
2018-01-16 11:17:57 +00:00
2018-12-22 20:34:58 +00:00
2018-10-19 17:57:53 +00:00
2019-09-05 07:02:28 +00:00
2018-06-20 22:56:37 +00:00
2018-12-22 08:43:08 +00:00
2017-12-09 00:39:53 +00:00
2019-05-25 00:07:22 +00:00
2019-08-09 01:14:33 +00:00
2019-05-24 01:41:58 +00:00
2019-05-25 00:07:22 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2017-10-10 14:15:25 +00:00
2017-12-04 21:27:46 +00:00
2019-01-08 17:52:29 +00:00
2018-05-09 02:40:45 +00:00
2018-12-22 08:43:08 +00:00
2019-07-16 21:15:19 +00:00
2018-12-18 19:40:22 +00:00
2018-05-09 02:40:45 +00:00
2019-08-23 16:33:42 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2019-05-10 10:03:41 +00:00
2018-01-29 12:37:30 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2019-05-15 02:35:32 +00:00
2018-05-09 02:40:45 +00:00
2018-05-04 16:10:43 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2019-02-12 01:19:00 +00:00
2019-05-01 05:27:20 +00:00
2018-08-16 21:29:55 +00:00
2018-08-16 21:29:55 +00:00
2018-11-11 18:57:28 +00:00
2018-08-16 21:29:55 +00:00
2018-08-16 21:29:55 +00:00
2019-06-14 01:58:56 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-12-20 20:46:55 +00:00
2018-12-18 01:06:09 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2019-06-12 13:41:56 +00:00
2019-09-04 11:09:05 +00:00
2019-08-29 10:53:29 +00:00
2018-11-14 21:11:53 +00:00
2019-06-06 21:19:39 +00:00
2019-08-25 10:54:44 +00:00
2019-06-17 09:13:29 +00:00
2018-10-30 23:28:27 +00:00
2018-06-21 07:02:46 +00:00
2019-01-15 16:18:52 +00:00
2018-05-09 02:40:45 +00:00
2018-07-04 13:28:39 +00:00
2018-08-23 22:35:58 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2019-04-11 20:25:10 +00:00
2018-05-09 02:40:45 +00:00
2018-08-16 21:29:55 +00:00
2018-05-09 02:40:45 +00:00
2018-09-13 13:13:50 +00:00
2018-04-10 14:23:41 +00:00
2018-05-09 02:40:45 +00:00
2019-01-15 16:18:52 +00:00
2019-01-15 16:18:52 +00:00
2019-01-15 16:18:52 +00:00
2018-07-13 16:06:17 +00:00
2019-03-19 19:01:34 +00:00
2018-10-29 20:10:42 +00:00
2018-09-05 10:18:36 +00:00
2019-05-03 19:06:57 +00:00
2018-05-09 02:40:45 +00:00
2019-04-10 11:28:20 +00:00
2018-09-05 10:18:36 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2019-06-17 09:13:29 +00:00
2018-05-09 02:40:45 +00:00
2018-10-30 23:28:27 +00:00
2019-06-19 00:25:39 +00:00
2019-01-15 16:18:52 +00:00
2019-08-29 19:03:58 +00:00
2019-06-17 09:13:29 +00:00
2019-01-14 10:55:55 +00:00
2018-07-18 20:37:01 +00:00
2018-11-13 20:08:10 +00:00
2017-10-10 14:15:25 +00:00
2019-06-10 15:23:46 +00:00
2018-05-09 02:40:45 +00:00
2018-07-26 22:48:52 +00:00
2018-10-20 07:36:39 +00:00
2018-05-09 02:40:45 +00:00
2019-06-19 00:25:39 +00:00
2018-10-30 23:28:27 +00:00
2019-06-19 00:25:39 +00:00
2019-06-19 00:25:39 +00:00
2019-06-19 00:25:39 +00:00
2019-06-19 00:25:39 +00:00
2019-06-19 00:25:39 +00:00
2019-06-19 00:25:39 +00:00
2019-06-19 00:25:39 +00:00
2018-10-30 23:28:27 +00:00
2018-10-30 23:28:27 +00:00
2018-10-29 20:10:42 +00:00
2018-10-30 23:28:27 +00:00
2018-12-11 21:26:52 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2019-05-07 13:14:18 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-10-24 23:36:29 +00:00
2018-09-05 10:18:36 +00:00
2018-05-09 02:40:45 +00:00
2019-09-04 14:19:49 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-09-05 10:18:36 +00:00
2019-06-10 15:23:46 +00:00
2018-09-13 13:13:50 +00:00
2018-12-22 08:43:08 +00:00
2018-12-22 08:43:08 +00:00
2018-12-22 08:43:08 +00:00
2018-03-01 21:53:17 +00:00
2018-05-09 02:40:45 +00:00
2019-05-16 12:50:39 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2019-04-11 20:25:10 +00:00
2019-08-13 17:00:54 +00:00
2018-05-09 02:40:45 +00:00
2018-09-20 09:17:36 +00:00
2019-05-10 19:15:29 +00:00
2019-04-24 18:09:44 +00:00
2019-05-28 13:23:25 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2019-04-11 20:25:10 +00:00
2018-05-09 02:40:45 +00:00
2018-05-09 02:40:45 +00:00
2018-08-21 23:42:08 +00:00
2018-10-29 20:10:42 +00:00
2018-05-09 02:40:45 +00:00
2019-04-27 16:12:14 +00:00
2018-05-09 02:40:45 +00:00