GCC Middle and Back End API Reference
gimple-ssa-warn-restrict.cc File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "tree.h"
#include "gimple.h"
#include "tree-pass.h"
#include "pointer-query.h"
#include "ssa.h"
#include "gimple-pretty-print.h"
#include "gimple-ssa-warn-access.h"
#include "gimple-ssa-warn-restrict.h"
#include "diagnostic-core.h"
#include "fold-const.h"
#include "gimple-iterator.h"
#include "tree-dfa.h"
#include "tree-ssa.h"
#include "tree-cfg.h"
#include "tree-object-size.h"
#include "calls.h"
#include "cfgloop.h"
#include "intl.h"
#include "gimple-range.h"
Include dependency graph for gimple-ssa-warn-restrict.cc:

Macros

#define INCLUDE_MEMORY
 

Functions

opt_code check_bounds_or_overlap (gimple *call, tree dst, tree src, tree dstsize, tree srcsize, bool bounds_only, bool do_warn)
 
opt_code check_bounds_or_overlap (pointer_query &ptrqry, gimple *call, tree dst, tree src, tree dstsize, tree srcsize, bool bounds_only, bool do_warn)
 
gimple_opt_passmake_pass_warn_restrict (gcc::context *ctxt)
 
DEBUG_FUNCTION void dump_builtin_memref (FILE *fp, const builtin_memref &ref)
 
DEBUG_FUNCTION void dump_builtin_access (FILE *fp, gimple *stmt, const builtin_access &acs)
 
DEBUG_FUNCTION void debug (gimple *stmt, const builtin_access &acs)
 

Macro Definition Documentation

◆ INCLUDE_MEMORY

#define INCLUDE_MEMORY
Pass to detect and issue warnings for violations of the restrict
qualifier.
Copyright (C) 2017-2024 Free Software Foundation, Inc.
Contributed by Martin Sebor <msebor@redhat.com>.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.   

Function Documentation

◆ check_bounds_or_overlap() [1/2]

opt_code check_bounds_or_overlap ( gimple * call,
tree dst,
tree src,
tree dstsize,
tree srcsize,
bool bounds_only,
bool do_warn )
Attempt to detect and diagnose invalid offset bounds and (except for
memmove) overlapping copy in a call expression EXPR from SRC to DST
and DSTSIZE and SRCSIZE bytes, respectively.  Both DSTSIZE and
SRCSIZE may be NULL.  DO_WARN is false to detect either problem
without issue a warning.  Return the OPT_Wxxx constant corresponding
to the warning if one has been detected and zero otherwise.   

References cfun, check_bounds_or_overlap(), and get_range_query().

Referenced by check_bounds_or_overlap(), gimple_fold_builtin_memory_op(), strlen_pass::handle_builtin_strcat(), strlen_pass::handle_builtin_strcpy(), and strlen_pass::handle_builtin_stxncpy_strncat().

◆ check_bounds_or_overlap() [2/2]

opt_code check_bounds_or_overlap ( pointer_query & ptrqry,
gimple * call,
tree dst,
tree src,
tree dstsize,
tree srcsize,
bool bounds_only,
bool do_warn )

◆ debug()

DEBUG_FUNCTION void debug ( gimple * stmt,
const builtin_access & acs )

References dump_builtin_access().

◆ dump_builtin_access()

DEBUG_FUNCTION void dump_builtin_access ( FILE * fp,
gimple * stmt,
const builtin_access & acs )

References print_gimple_expr(), and TDF_LINENO.

Referenced by debug().

◆ dump_builtin_memref()

DEBUG_FUNCTION void dump_builtin_memref ( FILE * fp,
const builtin_memref & ref )

References print_generic_expr(), and TDF_LINENO.

◆ make_pass_warn_restrict()

gimple_opt_pass * make_pass_warn_restrict ( gcc::context * ctxt)