blob: 93a09363b191cbfebdc7484ded0a86553760b4ad (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#!/usr/bin/env perl
# Copyright (C) 2017 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
use strict;
use warnings;
package QtQA::App::DivideByZero;
# This script deliberately performs an integer division by zero.
use Inline 'C';
sub main
{
divide_by_zero();
die 'unexpectedly still alive after dividing by zero!';
}
main unless caller;
1;
__DATA__
__C__
#include <stdio.h>
void divide_by_zero()
{
int i = 0;
/* fprintf ensures compiler can't optimize this out */
fprintf(stderr, "1/i %d\n", (1/i));
}
|