t_ubsan_int_neg_overflow.sh revision 1.4
11.4Smgorny# Copyright (c) 2018, 2019 The NetBSD Foundation, Inc. 21.1Skamil# All rights reserved. 31.1Skamil# 41.1Skamil# This code is derived from software contributed to The NetBSD Foundation 51.1Skamil# by Harry Pantazis. 61.1Skamil# 71.1Skamil# Redistribution and use in source and binary forms, with or without 81.1Skamil# modification, are permitted provided that the following conditions 91.1Skamil# are met: 101.1Skamil# 1. Redistributions of source code must retain the above copyright 111.1Skamil# notice, this list of conditions and the following disclaimer. 121.1Skamil# 2. Redistributions in binary form must reproduce the above copyright 131.1Skamil# notice, this list of conditions and the following disclaimer in the 141.1Skamil# documentation and/or other materials provided with the distribution. 151.1Skamil# 161.1Skamil# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 171.1Skamil# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 181.1Skamil# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 191.1Skamil# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 201.1Skamil# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 211.1Skamil# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 221.1Skamil# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 231.1Skamil# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 241.1Skamil# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 251.1Skamil# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 261.1Skamil# POSSIBILITY OF SUCH DAMAGE. 271.1Skamil# 281.1Skamil 291.4SmgornyUBSAN_CODE=' 301.1Skamil#include <limits.h> 311.1Skamil#include <stdio.h> 321.1Skamil#include <stdlib.h> 331.1Skamilint help(int); 341.4Smgorny#ifndef PIC_MAIN 351.4Smgornyint help(int count) {volatile int l = INT_MIN; l = -l; return l;} 361.4Smgorny#endif 371.4Smgorny#ifndef PIC_FOO 381.1Skamilint main(int argc, char **argv) {return help(argc);} 391.4Smgorny#endif 401.4Smgorny' 411.1Skamil 421.4Smgornyubsan_test_case int_neg_overflow "int negation overflows" "negation of" 431.1Skamil 441.1Skamilatf_init_test_cases() 451.1Skamil{ 461.4Smgorny ubsan_add_test_cases int_neg_overflow 471.1Skamil} 48