diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 9ef407c7c98..ce948c8222e 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+2017-10-04  Pavel I. Kryukov <kryukov@frtk.ru>
+
+	PR 22245
+	* bfd.c (bfd_set_error): Avoid UB on passing arg to va_start that
+	undergoes default promotion.
+	* bfd-in2.h: Regenerate.
+
 2017-10-02  Alan Modra  <amodra@gmail.com>
 
 	* elf32-ppc.c (ppc_elf_relocate_section): Fix comment typo.
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index d126aed0868..62be566e753 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -7054,7 +7054,7 @@ bfd_error_type;
 
 bfd_error_type bfd_get_error (void);
 
-void bfd_set_error (bfd_error_type error_tag, ...);
+void bfd_set_error (int error_tag, ...);
 
 const char *bfd_errmsg (bfd_error_type error_tag);
 
diff --git a/bfd/bfd.c b/bfd/bfd.c
index 665f182559b..5da1a6fd53a 100644
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -497,7 +497,7 @@ FUNCTION
 	bfd_set_error
 
 SYNOPSIS
-	void bfd_set_error (bfd_error_type error_tag, ...);
+	void bfd_set_error (int error_tag, ...);
 
 DESCRIPTION
 	Set the BFD error condition to be @var{error_tag}.
@@ -507,7 +507,7 @@ DESCRIPTION
 */
 
 void
-bfd_set_error (bfd_error_type error_tag, ...)
+bfd_set_error (int error_tag, ...)
 {
   bfd_error = error_tag;
   if (error_tag == bfd_error_on_input)